2013-04-26 57 views
1

当我在Wordpress中使用默认的帖子类型时,上面的代码运行良好。但是对于自定义帖子类型,它什么也没有显示。the_content没有显示任何一个costum帖子类型

<?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; 
    ?> 

您的帮助是高度赞赏

回答

0

自定义文章类型不是帖子。

因此,解决办法是:

$my_query->query(array('post_type' => 'aya-bi-aya', 'post__in' => array($p))); 

寻找解决方案小时,并在SO

发布后的问题找到它分钟