
https://r300nakata-2022.bitter.jp/wp2022/
functions.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
<?php ////アイキャッチ画像使用 add_theme_support('post-thumbnails'); //自動挿入のpタグを無効 add_action('init', function() { remove_filter('the_excerpt', 'wpautop'); remove_filter('the_content', 'wpautop'); }); add_filter('tiny_mce_before_init', function($init) { $init['wpautop'] = false; $init['apply_source_formatting'] = ture; return $init; }); //ウィジェットを使用 function widgets_add(){ register_sidebar( array( 'name' => 'サイドバー1', 'id' => 'sidebar', 'before_widget' => '<div>', 'after_widget' => '</div>', 'before_title' => '<h2 class="title">', 'after_title' => '</h2>', ) ); } add_action('widgets_init', 'widgets_add'); //ダッシュボード側で公開日の時間まで表示 function date_display( $date, $post ) { $date .= '<br />' . get_post_time( 'H:i', false, $post ); return $date; } add_filter('post_date_column_time', 'date_display', 10, 2); //アイキャッチのカラム追加 function thumbnail_columns($columns){ $columns['thumbnail'] = __('アイキャッチ'); return $columns; } add_filter('manage_posts_columns', 'thumbnail_columns'); //アイキャッチ画像表示 function thumbnail_display($column_name, $post_id){ echo ( $thumbnail = get_the_post_thumbnail($post_id, 'small', array('style'=>'width:50px; height:50px;')) ) ? $thumbnail : __('未登録'); } add_action('manage_posts_custom_column', 'thumbnail_display', 10, 2); |