List pending Posts
-
I wanted to know how to list pending posts in the frontend, and i finally did it… but i wanted to share the code i have used in order to know if i am using a proper way to list pending posts.
I don’t know much about coding, so i copy codes and try if they work… until i get the final solution i found 2 ways of doing it:
First is writing this code just before the start of the Loop in a custom page template:
<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args= array( 'post_status' => 'pending', 'paged' => $paged ); query_posts($args); ?>Second is doing the same but with this code:
<?php $args= array( 'post_type' => 'post', 'post_status' => 'pending' ); query_posts($args); ?>Number 1 and 2 were not working fine…. but finally i found the third one :
<?php query_posts('showposts=10&post_status=pending'); ?>And it works… you can watch it in action here.
So, is the third one a proper solution?
Many thanks!
Lucas
The topic ‘List pending Posts’ is closed to new replies.