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.
关注
码龄 粉丝数 原力等级 --
- 被采纳
- 被点赞
- 采纳率

已采纳
如何在wordpress中显示所有页面的帖子
收起
- 写回答
- 好问题 0 提建议
- 关注问题
微信扫一扫
点击复制链接分享
- 邀请回答
- 编辑 收藏 删除 结题
- 收藏 举报
1条回答 默认 最新
- 关注
码龄 粉丝数 原力等级 --
- 被采纳
- 被点赞
- 采纳率
douluolan9101 2014-04-01 12: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();?>
本回答被题主选为最佳回答 , 对您是否有帮助呢? 本回答被专家选为最佳回答 , 对您是否有帮助呢? 本回答被题主和专家选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏举报微信扫一扫
点击复制链接分享
编辑预览轻敲空格完成输入- 显示为
- 卡片
- 标题
- 链接
评论按下Enter换行,Ctrl+Enter发表内容
编辑
预览

轻敲空格完成输入
- 显示为
- 卡片
- 标题
- 链接
报告相同问题?
提交
- 2018-10-11 09:13回答 2 已采纳 First you need to specify that this is a page template by adding the following code to the top of
- 2012-12-05 02:10回答 2 已采纳 Try this piece of code where you want to show the blog content <div class="blog-post-wrap">
- 2017-09-08 13:17回答 1 已采纳 <?php $recent = new WP_Query( array( 'posts_per_page' => 5, 'order' => 'DESC',
- 2020-10-04 19:30cuma1988的博客 One of the gripes I’ve always had with the built-in WordPress functionality is that you can only specify the number of posts per page across the entire application, as opposed to being able to ...
- 2016-07-07 12:28回答 1 已采纳 For your first question wp grabs the title of the home page based on query_posts() this is what m
- 2016-01-05 18:50回答 2 已采纳 Here is a modified version of a post I have done on WPSE a while ago FROM WPSE STEP 1 We neet t
- 2014-05-03 13:04回答 1 已采纳 If I understand well the code would work like this: 1 Take the id number from url and stored 1.1 h
- 2020-09-06 23:19cumohuo9136的博客 Do you want to display all your WordPress posts on one page? Recently one of our readers wanted to create an archives page and show all WordPress posts on a single page. In this article, we will show ...
- 2018-06-02 03:15回答 2 已采纳 you can use this plugin i think you will solve your 404 page solve.. this plugin
- 2014-05-17 02:01回答 1 已采纳 You can not write php codes in editor. From what you want your normal archive.php should be showi
- 2016-02-16 13:31回答 4 已采纳 You should require wp-load.php via the full path to this file. Hardcoded example: require_once("
- 2020-09-08 03:01cumohuo9136的博客 Have you ever wanted to showcase your recent posts from each category in your WordPress sidebar? Recently, one of our users asked us for an easy way to display recent posts from a specific category in...
- 2020-09-14 21:45cumyupx7788305的博客 Do you want to show your recent posts in WordPress? Displaying recent posts help users easily discover your new ... 您想在WordPress中显示您最近的帖子吗? 显示最新帖子可帮助用户轻松发现您的新内容,...
- 2020-09-14 05:40cumohuo9136的博客 隐藏wordpress后台Have you ever wanted to hide a blog post from your WordPress ... 您是否曾经想从WordPress主页或博客存档页面隐藏博客文章? While you can make WordPress posts password protected or pr...
- `WP-exec-PHP`是一个专门为WordPress平台设计的插件,它允许用户在WordPress的帖子、页面、文本小部件甚至文本小部件标题中直接执行PHP代码。这对于需要进行定制化开发或者需要在内容中动态处理数据的用户来说,提供...
- 没有解决我的问题, 去提问
联系我们(工作时间:8:30-22:00)
400-660-0108kefu@csdn.net在线客服
- 京ICP备19004658号
- 经营性网站备案信息
公安备案号11010502030143
- 营业执照
- 北京互联网违法和不良信息举报中心
- 家长监护
- 中国互联网举报中心
- 网络110报警服务
- Chrome商店下载
- 账号管理规范
- 版权与免责声明
- 版权申诉
- 出版物许可证
- ©1999-2025北京创新乐知网络技术有限公司