Wordpress 未找到自定义帖子类型详细信息页面,而是返回single.php页面
我有自定义的邮件类型( 我的产品 )在WordPress中,当我点击ReadMore链接以显示帖子详细信息时,它会返回到single.php页面,而不是single\u product.php页面模板。 任何帮助。 这是我的密码:Wordpress 未找到自定义帖子类型详细信息页面,而是返回single.php页面,wordpress,Wordpress,我有自定义的邮件类型( 我的产品 )在WordPress中,当我点击ReadMore链接以显示帖子详细信息时,它会返回到single.php页面,而不是single\u product.php页面模板。 任何帮助。 这是我的密码: <?php query_posts(array('post_type'=>'my_product','posts_per_page'=>1,'orderby'=>'rand')); if(have_posts()): w
<?php query_posts(array('post_type'=>'my_product','posts_per_page'=>1,'orderby'=>'rand'));
if(have_posts()): while(have_posts()): the_post(); ?>
<div class="media">
<div class="media-left">
<a href="#" class="post-thumbnail">
<?php if (has_post_thumbnail()) {
the_post_thumbnail();
} else { ?>
<img class="media-object new-pro-slide-img" src="<?php bloginfo('template_url');?>/images/default.jpg" class="img-responsive" alt="..." style="max-width: 200px; max-height: 150px;">
<?php }?>
</a>
</div>
<div class="media-body media-body-white media-body-white">
<h4 class="media-heading"><?php the_title();?></h4>
<p><?php the_excerpt(); ?>
</p>
<a href="<?php the_permalink(); ?>"><b>بیشتر بدانید</b> <i class="fa fa-chevron-left"></i></a>
</div>
</div>
<?php endwhile;
您使用了错误的文件,您必须使用single-my_product.php这是single-post_类型,这里您的post类型是my_产品,因此请使用single-my_product.php而不是single-product.php。您使用了错误的文件,您必须使用single-my_product.php这是single-post_类型,这里您的帖子类型是my_product,因此请使用single-my_product.php而不是single-product.php。我已在设置>永久链接中将永久链接设置为帖子名称我已在设置>永久链接中将永久链接设置为帖子名称