doulang7699 2014-04-01 18:56
浏览 33
已采纳

如何在wordpress中显示所有页面的帖子

Currently I am trying to develop wordpress one page portfolio theme. Now it shows blog posts and page posts. I have created a custom page template for displaying one page portfolio items. It will display post from those pages which user will create from theme menu. Now I need to create that, but I have no idea how to do that. Please note that it will display only those page posts which user created from theme menu , and it will show those page navigation link(although I dont need any help about that , but I need help to show pages post) , and another thing is that , it will not display blog posts.

  • 写回答

1条回答 默认 最新

  • douluolan9101 2014-04-01 20:49
    关注

    Run a WP_Query on your index page, and inside the loop add the page contents

    <?php $args = array(
            'post_type' => 'page', // Calling pages only
            'order' => 'ASC',
            'posts_per_page'=> '-1',  // display all pages published
        );
    
    $loop = new WP_Query( $args ); if( $loop->have_posts() ): while( $loop->have_posts() ): $loop->the_post();?>
    
    <?php the_title(); //Page Contents etc.?>
    
    <?php endwhile; endif; wp_reset_postdata();?>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 spss统计中二分类变量和有序变量的相关性分析可以用kendall相关分析吗?
  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
  • ¥15 相敏解调 matlab
  • ¥15 求lingo代码和思路
  • ¥15 公交车和无人机协同运输