specifying which category to post
-
I have created a page template that is used by all my pages and it calls in “recent posts”. I have used category-visibility plugin to limit which post are shown on the frontpage but now want to limit posts shown on my “pages”. For example page1 should only show posts for category1. Here is my page template as of now:
<?php /* Template Name: sportpage */ ?> <?php get_header(); ?> <div id="content" class="narrowcolumn"> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <h2><?php the_title(); ?></h2> <div class="entry"> <?php the_content('<p class="serif">Read the rest of this page »</p>'); ?> <?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?> </div> </div> <?php endwhile; endif; ?> <?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?> <!-- start posts --> <?php $recentposts = new WP_Query('showposts=3&offset=1'); if($recentposts->have_posts()) : while($recentposts->have_posts()) : $recentposts->the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <div class="posttitle"> <h2><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2> <p class="meta"> <?php the_time('F'); ?> <?php the_time('jS Y'); ?> under <?php the_category(' & ') ?> <?php edit_post_link(); ?></p> </div> <div class="postcontent"> <?php the_excerpt(); ?> </div> <div class="postfeedback"> <?php wp_link_pages(); ?> <?php comments_popup_link('Comments (0)', 'Comments (1)', 'Comments (%)', 'commentlink', ''); ?> </div> </div> <?php endwhile; endif; ?> <!-- end posts--> </div> <?php get_sidebar(); ?> <?php get_footer(); ?>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘specifying which category to post’ is closed to new replies.