Displaying category posts on a page
-
Hi all,
I am trying to display all posts in a specific category (ID6) on a newly created page (ID7), but I am having trouble. So far I have tried to add a new WP_query to a copy of the page template underneath the the_content(); call. However that deos not work.
Does anyone have any suggestion on how I can achieve this to maintain the ease of editing the page that this template is linked to?
Thanks,
Sebastian<?php /* Template Name: Staff */ ?> <?php get_header() ?> <div id="container"> <div id="content"> <?php the_post() ?> <div id="post-<?php the_ID() ?>" class="<?php sandbox_post_class() ?>"> <h2 class="entry-title"><?php the_title() ?></h2> <div class="entry-content"> <?php the_content() ?> <!-- Display the staff posts --> <?php $thestaff = new WP_Query(); $thestaff->query('category_name=Staff&showposts=-1'); while($thestaff->have_posts()) : $thestaff->the_post(); ?> <div class="thepost"> <h4><?php the_title(); ?></h4> <div class="theentry"> <?php the_content('<br />Read complete article'); ?> </div> </div> <?php endwhile; ?> <!-- End staff posts --> <?php wp_link_pages('before=<div id="page-links">'.'Pages: '.'&after=</div>&next_or_number=next&nextpagelink=Next Page&previouspagelink=Earlier'); ?> <?php edit_post_link( __( 'Edit', 'sandbox' ), '<span class="edit-link">', '</span>' ) ?> </div> </div><!-- .post --> <?php if ( get_post_custom_values('comments') ) comments_template() // Add a key+value of "comments" to enable comments on this page ?> </div><!-- #content --> </div><!-- #container --> <?php get_sidebar() ?> <?php get_footer() ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Displaying category posts on a page’ is closed to new replies.