category template – how to show posts links
-
I want to use a “category template” instead of “Archive.php” page.
When someone clicks on a category (showing in sidebar) of ID=12, then the result page should be shown thru category.php
On the result page,
1) all the posts under category=12 should be shown as links (last post’s link on top and oldest post link in last)
2) the links should be limited to 15 in number, per page. i.e. more than 15-links should not be shown on a single page.I have tried the following code, but it returned links of posts from all categories ….
<?php if (is_category()) { ?> <ul> <?php $recent = new WP_Query("cat=&showposts=15"); while($recent->have_posts()) : $recent->the_post();?> <li><a href="<?php the_permalink() ?>" rel="bookmark"> <?php the_title(); ?> </a></li> <?php endwhile; ?> </ul> <?php } else { ?> <p>No Result found</p> <?php } ?>
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘category template – how to show posts links’ is closed to new replies.