前提・実現したいこと
WordpressでCustom Post Type UIにてデフォルトと別でカスタム投稿ページ(blog)を作成しました。
投稿一覧より個別のページを表示すると、本文(Contents)が全く表示されません。。。
※<h1>のタイトルだけ問題なく表示されています。
ちなみにホームページ自体は業者さんにて作成して頂きました。
デフォルト?の投稿(shingle.php)をコピーして「shingle-blog.php」を編集しました。
wordpressの設定、phpの記述などで違っている部分がありましたら、
教えていただけますでしょうか?
当方HTML言語は多少わかりますが、WordPressとPHPの知識がない為、よろしくお願い致します。
■カスタム投稿名:blog
発生している問題
個別のページを表示すると、本文(Contents)が表示されない。 <h1>タイトルは表示される
該当のソースコード
■ファイル名:shingle-blog.php <?php get_header(); ?> <div class="box04"> <div class="breadcrumbs size f1"> <span property="itemListElement" typeof="ListItem"><a property="item" typeof="WebPage" title="XXXXXXXXXXX" href="<?php echo esc_url(home_url('/')); ?>/" class="home"><span property="name">ホーム</span></a><meta property="position" content="1"></span> > <span property="itemListElement" typeof="ListItem"><a property="item" typeof="WebPage" title="ブログ" href="<?php echo esc_url(home_url('blog')); ?>/"><span property="name">ブログ</span></a><meta property="position" content="2"></span> > <span property="itemListElement" typeof="ListItem"><span property="name"><?php the_title(); ?></span><meta property="position" content="3"></span> </div> </div> <div class=""> <?php if ( have_posts() ): while ( have_posts() ) :the_post(); ?> <h1 class="page_ttl min box04"><span><?php the_title() ?></span></h1> <div class="entry clearfix size"> <?php $post_format = SCF::get( 'post-format' ); $length = count($post_format); foreach ( (array)$post_format as $fields ) { $counter++; ?> <?php if(($counter == $length) && ($counter % 2 == 0) ) { ?> <div class="post_content last lightgray"> <?php } else if( ($counter == $length) && ($counter % 2 == 1)) { ?> <div class="post_content last"> <?php } else if( $counter % 2 == 0) { ?> <div class="post_content lightgray"> <?php } else { ?> <div class="post_content"> <?php } ?> <?php if($fields['post-title']) { ?> <h1 class="h2_01 min box04 ta_c"><?php echo esc_html($fields['post-title']); ?></h1> <?php } ?> <?php if ($fields['post-radio'] == "横幅に対して1枚表示") { ?> <div class="format01 box04"> <?php $image = get_post_meta($post->ID, 'post-img', true); echo wp_get_attachment_image($fields['post-img'], 'full'); ?> <div> <?php echo $fields['post-txt'] ; ?> </div> </div> <?php } else if ($fields['post-radio'] == "右") { ?> <div class="format02 box04 clearfix"> <?php $image = get_post_meta($post->ID, 'post-img', true); echo wp_get_attachment_image($fields['post-img'], 'full'); ?> <div> <?php echo do_shortcode ($fields['post-txt'] ); ?> </div> </div> <?php } else if ($fields['post-radio'] == "左") { ?> <div class="format03 box04 clearfix"> <?php $image = get_post_meta($post->ID, 'post-img', true); echo wp_get_attachment_image($fields['post-img'], 'full'); ?> <div> <?php echo do_shortcode ($fields['post-txt'] ); ?> </div> </div> <?php } else { ?> <div class="box04"> <?php echo do_shortcode ($fields['post-txt'] ); ?> </div> <?php } ?> </div> <!-- post_content --> <?php } ?> </div> <!-- entry --> <?php endwhile; else: echo'記事はありません。'; endif;?> <div class="single_btn"> <a href="<?php // echo esc_url(home_url('blog')); ?>/" class="re_btn">一覧へ戻る</a><br> <?php //ページナビ previous_post_link( '%link', '<span class="prev">« 前へ</span>'); next_post_link( '%link', '<span class="next">次へ »</span>'); ?> </div> <!-- single_btn --> </div> <!-- box04 --> <?php get_footer(); ?>
試したこと
◆投稿の設定◆
name: blog
label: ブログ
singular_label: ブログ
description: ""
public: true
publicly_queryable: true
show_ui: true
show_in_nav_menus: true
show_in_rest: true
rest_base: ""
rest_controller_class: ""
has_archive: true
has_archive_string: ""
exclude_from_search: false
capability_type: post
hierarchical: false
rewrite: true
rewrite_slug: ""
rewrite_withfront: true
query_var: true
query_var_slug: ""
menu_position: ""
show_in_menu: true
show_in_menu_string: ""
menu_icon: ""
custom_supports: ""
◆タクソノミー◆
category
post_tag
補足情報(FW/ツールのバージョンなど)
wordpressのバージョン: WordPress 4.9.2
導入プラグイン: Custom Post Type UI
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/11/16 12:26