自分のレベル的に言えば、ギリギリCodexで書かれていることを理解できないところです。
ですので、いろいろなサイトをめぐって[functions.php]と[single-test.php]を作ってみました。
が、管理画面に表示と投稿ができても記事表示ができません。
すみません、助けてください。
タイプミスかとさえ思っています。
[single-test.php]
php
1<?php /* Template Name: */ get_header(); ?> 2 <?php if (have_posts()) : while (have_posts()) : the_post(); ?> 3 <h3><a href="<?php the_permalink(); ?>"><?php echo get_the_title(); ?></a></h3> 4 <div class="article clearfix"> 5 </div> 6 <div class="breadcrumbs"><?php if(function_exists('bcn_display')) { bcn_display(); }?></div> 7 <div class="pager clearfix"><?php previous_post_link('%link', '« %title', TRUE); next_post_link('%link', '%title »' ,TRUE); ?></div> 8 <?php endwhile; else: ?> 9 <h3>記事はありません</h3> 10 <p>お探しの記事は見つかりませんでした。</p> 11 <?php endif; ?> 12<?php get_sidebar(); ?> 13<?php get_footer(); ?>
[functions.php]
php
1//カスタム投稿タイプ 2add_action( 'init', 'custum_post_type' ); 3function custum_post_type() { 4 register_post_type( 'test', 5 array('labels' => 6 array( 7 'name' => __( '日本語でおK' ), 8 'singular_name' => __( '日本語でおK' ) 9 ), 10 'public' => true, 11 'menu_position' => 5, 12 'hierarchicla' => false, 13 'has_archive' => true, 14 'supports' => array('title','editor','thumbnail', //タイトル,編集,アイキャッチ 15 'custom-fields','excerpt','author','trackbacks', //カスタムフィールド,抜粋文&作成者,トラックバック 16 'comments','revisions','page-attributes') //コメント,リビジョン,作成者,表示順のボックス 17 ) 18 ); 19}
'singular_name' => __( '日本語でおK' )``` が問題でしょうか?
回答2件
あなたの回答
tips
プレビュー