functionsを触りすぎていて、消えていることに今さら気付いて、、
でも項目を加え過ぎてしまって何が原因かわかりません。
ソースは以下です。
乱文失礼なのですが、何が問題でしょうか?
functions.php
php
1<?php /* Template Name: WP1 */ 2 3// メインコンテンツの幅を指定 4if ( ! isset( $content_width ) ) $content_width = 960; 5 6// タイトルタグ 7function my_setup_theme() { 8 add_theme_support( 'title-tag' ); 9} 10add_action( 'after_setup_theme', 'my_setup_theme' ); 11 12// カスタムヘッダー画像を設置する 13$custom_header_defaults = array( 14 'default-image' => get_template_directory_uri().'/images/image2.jpg', 15 'width' => auto, 16 'height' => auto, 17 'header-text' => false, 18); 19add_theme_support( 'custom-header', $custom_header_defaults ); 20 21// RSS2のfeedリンクを出力 22add_theme_support( 'automatic-feed-links' ); 23 24// カスタムメニューを有効化 25add_theme_support( 'menus' ); 26 27// カスタムメニューの「場所」を設定 28register_nav_menus( array( 29 'header-navi' => 'ヘッダーのナビゲーション', 30) ); 31// サイドバーウィジットを有効化 32function arphabet_widgets_init() { 33 register_sidebar( array( 34 'name' => 'サイドバーウィジット', 35 'id' => 'sidebar', 36 'description' => 'サイドバーのウィジットエリアです。', 37 'before_widget' => '<div class="widget">', 38 'after_widget' => '</div>', 39 'before_title' => '<h4 class="widget-title">', 40 'after_title' => '</h4>', 41 )); 42} 43 44//moreリンク 45function custom_content_more_link( $output ) { 46 $output = preg_replace('/#more-[\d]+/i', '', $output ); 47 return $output; 48} 49add_filter( 'the_content_more_link', 'custom_content_more_link' ); 50 51// 抜粋 52function new_excerpt_mblength($length) { 53 return 50; 54} 55add_filter('excerpt_mblength', 'new_excerpt_mblength'); 56 57function new_excerpt_more($more) { 58 global $post; 59 return '<a href="'. get_permalink($post->ID) . '">' . '続きを読む' . '</a>'; 60} 61add_filter('excerpt_more', 'new_excerpt_more'); 62 63//アイキャッチのサイズを固定化 64add_theme_support( 'post-thumbnails' ); 65add_image_size( 'size', 200, 80, true ); 66 67//アイキャッチ画像 68function thumbnail_check( $post_id, $size='post-thumbnail' ) { 69 if ( has_post_thumbnail() ){ 70 $thumb = get_the_post_thumbnail( $post_id, $size ); 71 } else { 72 $thumb = '<img src="'.get_template_directory_uri().'/images/no-img.png" alt="">'; 73 } 74 echo $thumb; 75} 76 77//カスタム背景 78$custom_background_defaults = array( 79 'default-color' => 'dddddd', 80); 81add_theme_support( 'custom-background', $custom_background_defaults ); 82 83//検索キーワードハイライト 84function wps_highlight_results($text){ 85 if(is_search()){ 86 $sr = get_query_var('s'); 87 $keys = explode(" ",$sr); 88 $text = preg_replace('/('.implode('|', $keys) .')/iu', '<span class="bg-warning">'.$sr.'</span>', $text); 89 } 90 return $text; 91} 92add_filter('the_title', 'wps_highlight_results'); 93add_filter('the_content', 'wps_highlight_results'); 94 95//コメントフォームでのオートリンク機能を無効化) 96remove_filter('comment_text', 'make_clickable', 9); 97 98//wpautop()回避 99remove_filter('the_content', 'wpautop'); 100remove_filter('the_excerpt', 'wpautop'); 101 102//カスタム投稿タイプ 103add_action( 'init', 'custum_post_type' ); 104function custum_post_type() { 105 register_post_type( 106 'news', //カスタム投稿タイプ名 107 array( 108 'labels' => array( 109 'name' => 'ニュース', //ダッシュボードに表示される名前 110 'add_new_item' => 'ニュースを新規追加', //新規追加画面に表示される名前 111 'edit_item' => 'ニュースの編集', //編集画面に表示される名前 112 ), 113 'public' => true, //ダッシュボードに表示するか否か 114 'hierarchical' => false, // 階層型にするか否か 115 'menu_position' => 5, 116 'has_archive' => true, //trueにすると投稿した記事のアーカイブページを生成 117 'supports' => array( //カスタム投稿ページに表示される項目 118 'title', //タイトル 119 'editor', //編集 120 'thumbnail', //アイキャッチ 121 'custom-fields', //カスタムフィールド 122 'excerpt', //抜粋文 123 ), //表示順のボックス 124 ) 125 ); 126} 127 128remove_filter( 'pre_user_description', 'wp_filter_kses' ); 129 130?>
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/04/26 17:00