Support » Plugins and Hacks » View all Drafts to Print

  • Hi,

    Is there a way I can preview all my drafts in a format that will print?

    The idea is to product a paper-based version of posts that will not be made public until a future date.

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • list all pages and then all posts that are drafts

    <?php
    $types[0] = 'page';
    $types[1] = 'post';
    
    foreach ($types as $type) {
      $args=array(
        'post_type' => $type,
        'post_status' => 'draft',
        'showposts' => -1,
        'caller_get_posts'=> 1
        );
      $my_query = null;
      $my_query = new WP_Query($args);
      if( $my_query->have_posts() ) {
        echo 'List of: ' . $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().
    ?>

    Hi Michael,

    Thanks for the reply, that’s great.
    Would you be able to tell me where to put the code? An existing or new php file? If not, where should it go?

    Thanks again.

    The idea is to product a paper-based version of posts that will not be made public until a future date.

    I’d probably put it in a Page Template.

    Related:
    Stepping Into Template Tags
    Stepping Into Templates
    Template Hierarchy
    Templates

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘View all Drafts to Print’ is closed to new replies.