WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to list unapproved post (loop) (3 posts)

  1. Cristian Tacchi
    Member
    Posted 4 years ago #

    Hi,

    I'm using wordpress (this time) as a new ideas posting system and i was thinking about to use the approve and unapprove posts system to mark them so i can list the approved ideas BUT.. i need to list the "not yet approved" or "unapproved ideas" too..

    so...

    how can i list the "not yet approved" or "unapproved" posts??
    i need them so my ideas senders can see and check that your ideas were received and published...

  2. MichaelH
    Member
    Posted 4 years ago #

    <?php
    //list all pending pages and posts
    $types[0] = 'page';
    $types[1] = 'post';
    
    foreach ($types as $type) {
      $args=array(
        'post_type' => $type,
        'post_status' => 'pending',
        'showposts' => -1,
        'caller_get_posts'=> 1
        );
      $my_query = null;
      $my_query = new WP_Query($args);
      if( $my_query->have_posts() ) {
        echo 'List of pending: ' . $type .'(s)';
        while ($my_query->have_posts()) : $my_query->the_post(); ?>
          <p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
         <?php
        endwhile;
      } //if ($my_query)
    } // foreach
    wp_reset_query();  // Restore global post data stomped by the_post().
    ?>
  3. Cristian Tacchi
    Member
    Posted 4 years ago #

    Thanks a lottt!!! this really works as i need it..

    i love you guys.. you make us strong!!
    i love this whole comunity and thanks Michael for the answer

    bye

Topic Closed

This topic has been closed to new replies.

About this Topic