プラグインなどが上手く動かない場合はfunctions.phpを以下にしてみて下さい。
- jQueryは別途読み込んでください。
- 必ず、元のfunctionsの内容をどこかにコピペして保存しておいて下さい。
- 真っ白になった時はFTPからfunctions.phpをダウンロードして元の内容に戻してUPして下さい。
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 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
<?php //アイキャッチサムネイル add_theme_support('post-thumbnails'); add_image_size('thumb100',100,100,true); add_image_size('thumb110',110,110,true); //カスタムメニュー register_nav_menus(array('navbar' => 'ナビゲーションバー')); //カスタムヘッダー $args = array( 'width' => 986, 'height' => 150, 'flex-height' => true, 'default-image' => get_template_directory_uri() . '/images/stinger3.png', ); add_theme_support( 'custom-header', $args ); //RSS add_theme_support('automatic-feed-links'); //エディタスタイル add_theme_support('editor-style'); add_editor_style('editor-style.css'); function custom_editor_settings( $initArray ){ $initArray['body_class'] = 'editor-area'; return $initArray; } add_filter( 'tiny_mce_before_init', 'custom_editor_settings' ); //画像に重ねる文字の色 define('HEADER_TEXTCOLOR', ''); //画像に重ねる文字を非表示にする define('NO_HEADER_TEXT',true); //投稿用ファイルを読み込む get_template_part('functions/create-thread'); //カスタム背景 add_theme_support( 'custom-background' ); //ページャー機能 function pagination($pages = '', $range = 4) { $showitems = ($range * 2)+1; global $paged; if(empty($paged)) $paged = 1; if($pages == '') { global $wp_query; $pages = $wp_query->max_num_pages; if(!$pages) { $pages = 1; } } if(1 != $pages) { echo "<div class=\"pagination\"><span>Page ".$paged." of ".$pages."</span>"; if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "<a href='".get_pagenum_link (1)."'>« First</a>"; if($paged > 1 && $showitems < $pages) echo "<a href='".get_pagenum_link($paged - 1)."'>‹ Previous</a>"; for ($i=1; $i <= $pages; $i++) { if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems )) { echo ($paged == $i)? "<span class=\"current\">".$i."</span>":"<a href='".get_pagenum_link ($i)."' class=\"inactive\">".$i."</a>"; } } if ($paged < $pages && $showitems < $pages) echo "<a href=\"".get_pagenum_link($paged + 1)."\">Next ›</a>"; if ($paged < $pages-1 && $paged+$range-1 < $pages && $showitems < $pages) echo "<a href='".get_pagenum_link($pages)."'>Last »</a>"; echo "</div>\n"; } } //ウイジェット追加 if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar(4) ) register_sidebars(1, array( 'name'=>'サイドバー1', 'before_widget' => '<ul><li>', 'after_widget' => '</li></ul>', 'before_title' => '<h4 class="menu_underh2">', 'after_title' => '</h4>', )); register_sidebars(1, array( 'name'=>'スクロール広告用', 'before_widget' => '<ul><li>', 'after_widget' => '</li></ul>', 'before_title' => '<h4 class="menu_underh2" style="text-align:left;">', 'after_title' => '</h4>', )); register_sidebars(1, array( 'name'=>'Googleアドセンス用', 'before_widget' => '', 'after_widget' => '', 'before_title' => '<h4 style="display:none">', 'after_title' => '</h4>', )); register_sidebars(1, array( 'name'=>'Googleアドセンスのスマホ用width300', 'before_widget' => '', 'after_widget' => '', 'before_title' => '<h4 style="display:none">', 'after_title' => '</h4>', )); //contents widthの指定 if ( ! isset( $content_width ) ) $content_width = 546; //更新日の追加 function get_mtime($format) { $mtime = get_the_modified_time('Ymd'); $ptime = get_the_time('Ymd'); if ($ptime > $mtime) { return get_the_time($format); } elseif ($ptime === $mtime) { return null; } else { return get_the_modified_time($format); } } //ショートコードを外す function stinger_noshotcode( $content ) { if ( ! preg_match( '/\[.+?\]/', $content, $matches ) ) { return $content; } $content = str_replace( $matches[0], '', $content ); return $content; } ?> |
無くなる機能
- functionsによるjQueryの読み込み
- WordPress の投稿スラッグを自動的に生成する(※パーマリンクが変わる場合があります。)不安な場合は後述するコードを追記して下さい。
- ヘッダーを綺麗にする(余分なソースを取る)
- moreリンクの削除
- セルフピンバック禁止
WordPress の投稿スラッグを自動的に生成するコード
1 2 3 4 5 6 7 8 |
//WordPress の投稿スラッグを自動的に生成する function auto_post_slug( $slug, $post_ID, $post_status, $post_type ) { if ( preg_match( '/(%[0-9a-f]{2})+/', $slug ) ) { $slug = utf8_uri_encode( $post_type ) . '-' . $post_ID; } return $slug; } add_filter( 'wp_unique_post_slug', 'auto_post_slug', 10, 4 ); |