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 c程序不知道为什么得不到结果
- ¥40 复杂的限制性的商函数处理
- ¥15 程序不包含适用于入口点的静态Main方法
- ¥15 素材场景中光线烘焙后灯光失效
- ¥15 请教一下各位,为什么我这个没有实现模拟点击
- ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
- ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
- ¥20 有关区间dp的问题求解
- ¥15 多电路系统共用电源的串扰问题
- ¥15 slam rangenet++配置