2014-04-01 18:56
浏览 33


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.

图片转代码服务由CSDN问答提供 功能建议

目前我正在尝试开发wordpress一页组合主题。 现在它显示了博客文章和页面帖子。 我创建了一个自定义页面模板,用于显示一个页面组合项目。 它将显示用户将从主题菜单创建的那些页面的帖子。 现在我需要创建它,但我不知道该怎么做。 请注意,它只显示用户从主题菜单创建的那些页面帖子,它将显示那些页面导航链接(虽然我不需要任何帮助,但我需要帮助显示页面发布),另一件事是 ,它不会显示博客文章。

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

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();?>
    打赏 评论

相关推荐 更多相似问题