How to List Private Posts as Well as Published Ones
-
Okay, I’ve written a plugin that lists new posts as an addition to a page. It creates a “mini-loop” and lists the latest posts. This allows me to have a page (static home page) with a bunch of blather, and then a list of the latest posts under it.
What I want to be able to do is list published and private posts (of course, the private ones only show up if current_user_can(‘read_private_posts’)).
Here’s the basic code:
$posts = get_posts(''); ?><div class="listposts_new_posts"> <div class="listposts_header">Latest Information</div><?php while ( $mypost ) {
You get the idea. Very simple. The problem is that get_posts() only returns published posts.
I have spent all day searching the codex to figure out how I can add private posts to the returned posts, and I am now even more mixed up than I was when I started.
Any ideas? You can just tell me what M in RTFM I should read.
Thanks!
- The topic ‘How to List Private Posts as Well as Published Ones’ is closed to new replies.