get_posts and current page
-
I’m currently using this to display a set of links of 10 posts in one of my categories:
<ul> <?php $myposts = get_posts('numberposts=10&category=4'); foreach($myposts as $post) : ?> <li><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></li> <?php endforeach; ?> </ul>
I want to be able to add a class to the li tag when the current page is active. For example, my list looks like this:
page 1
page 2
page 3etc.
if I’m ON page 2, I want to add a class=”current” to my li tag so I can bold or largen my ‘page 2’ text.
I’ve tried to write my own if statement but I’m getting no where..
I need something like
if this page == catpageinlist echo class=”current” (you get the point)
Any ideas?
Thanks.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘get_posts and current page’ is closed to new replies.