Display last post in category with sidemenu class="active" for title
-
Hi.
I need figure out how to show last post from category when clicking menu item “category” and in sidebar there is menu for that category posts, who get active class when viewed.
There is sidebarelseif ( is_category( '15' ) ) { query_posts('cat=15&showposts=20'); ?> <?php while (have_posts()) : the_post(); ?> <li> <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"> <?php the_title(); ?></a></li> <?php endwhile; ?> <?php } elseif ( is_category( '16' ) ) { ?> <?php query_posts('cat=16&showposts=20'); ?> <?php while (have_posts()) : the_post(); ?> <li> <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"> <?php the_title(); ?></a></li> <?php endwhile; ?> <?php }
And there is category.php
<?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?> <h2><a> "> <?php the_title(); ?></a></h2> <div class="excerpt"> <?php the_excerpt(); ?> </div> <?php endwhile; else: ?> </p> <?php endif; ?>
- The topic ‘Display last post in category with sidemenu class="active" for title’ is closed to new replies.