admin管理员组文章数量:1130349
How to get list of pages of a specific user? And show them in a WordPress page.
Say i have page1 , page2 , page3 , page4 created by User1 .
How to list them in a page like this:
- page1 created: 1/1/2018 - 11:12 AM
- page2 created: 2/1/2018 - 10:00 PM
- page3 created: 3/1/2018 - 09:11 AM
- page4 created: 4/1/2018 - 12:12 PM
How to get list of pages of a specific user? And show them in a WordPress page.
Say i have page1 , page2 , page3 , page4 created by User1 .
How to list them in a page like this:
- page1 created: 1/1/2018 - 11:12 AM
- page2 created: 2/1/2018 - 10:00 PM
- page3 created: 3/1/2018 - 09:11 AM
- page4 created: 4/1/2018 - 12:12 PM
1 Answer
Reset to default 0I have found how to do it.
Here is the code:
$author_query = array('posts_per_page' => '-1','author' => 1,'post_type' => 'PAGE');
$author_posts = new WP_Query($author_query);
while($author_posts->have_posts()) : $author_posts->the_post();
?>
■ <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a> <br />
<?php
endwhile;
more information: see here
How to get list of pages of a specific user? And show them in a WordPress page.
Say i have page1 , page2 , page3 , page4 created by User1 .
How to list them in a page like this:
- page1 created: 1/1/2018 - 11:12 AM
- page2 created: 2/1/2018 - 10:00 PM
- page3 created: 3/1/2018 - 09:11 AM
- page4 created: 4/1/2018 - 12:12 PM
How to get list of pages of a specific user? And show them in a WordPress page.
Say i have page1 , page2 , page3 , page4 created by User1 .
How to list them in a page like this:
- page1 created: 1/1/2018 - 11:12 AM
- page2 created: 2/1/2018 - 10:00 PM
- page3 created: 3/1/2018 - 09:11 AM
- page4 created: 4/1/2018 - 12:12 PM
1 Answer
Reset to default 0I have found how to do it.
Here is the code:
$author_query = array('posts_per_page' => '-1','author' => 1,'post_type' => 'PAGE');
$author_posts = new WP_Query($author_query);
while($author_posts->have_posts()) : $author_posts->the_post();
?>
■ <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a> <br />
<?php
endwhile;
more information: see here
本文标签: List of pages of a specific user
版权声明:本文标题:List of pages of a specific user 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749186557a2329485.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论