WordPress.org

Support

Support » Themes and Templates » [Resolved] Custom Page Template – display posts

[Resolved] Custom Page Template – display posts

Viewing 2 replies - 1 through 2 (of 2 total)
  • <!-- Segment 2: display all post (title permalink and except) for $catstub category -->
    <?php
    $cat_id = get_cat_ID($currentcat);
    $args=array(
      'cat' => $cat_id,
      'post_type' => 'post',
      'post_status' => 'publish',
      'posts_per_page' => -1,
      'caller_get_posts'=> 1
    );
    $my_query = null;
    $my_query = new WP_Query($args);
    if( $my_query->have_posts() ) {
      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;
    }
    wp_reset_query();  // Restore global post data stomped by the_post().
    ?>
    <!-- -->

    Brilliant! Thank you.

    I’m still getting the hang of the WP_Query use and this helps tremendously.

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Custom Page Template – display posts’ is closed to new replies.