the_content对于Costum帖子类型不显示任何内容 [英] the_content is displaying nothing for a costum post type
本文介绍了the_content对于Costum帖子类型不显示任何内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我在Wordpress中使用默认帖子类型时,上面的代码运行良好。
When I was using the default post type in Wordpress, the code above was working well. But with custom post types, It is displaying nothing.
<?php
$p=$_GET['p'];
header('Content-Type: text/html; charset: UTF-8');
require( '../../../../wp-load.php' );
$my_query = new WP_Query();
$my_query->query(array( 'post__in' => array($p)));
if ($my_query->have_posts()) : while ($my_query->have_posts()) : $my_query->the_post();
echo the_content();
endwhile;
endif;
?>
我们非常感谢您的帮助
推荐答案
自定义帖子类型不是帖子。
Custom post types are not posts.
因此解决方案是:
$my_query->query(array('post_type' => 'aya-bi-aya', 'post__in' => array($p)));
寻找解决方案的时间,并在SO上发布问题后的几分钟找到它
Looking hours for solution, and finding it minutes after posting question on SO
这篇关于the_content对于Costum帖子类型不显示任何内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文