WordPress.org

Support

Support » How-To and Troubleshooting » Styling current post link in sidebar

Styling current post link in sidebar

  • In my current WP project I have a list of posts on the sidebar, but I wish to style the current open post link on the sidebar. Is there a way to insert a class to the link of the current open post in the sidebar? I am trying to make it looks like the hover that it haves.

    You can find the post list in this link: http://kiwimidia.com/pino/?cat=4

    I am using the following code to list the post titles in the sidebar:

    <ul>
        <?php
    	global $post;
    	$myposts = get_posts('numberposts=20&offset=0&category=3');
    	foreach($myposts as $post) :
        ?>
    
           <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
           <?php endforeach; ?>
    
    </ul>

    I´ve been trying to find some old resolved topic but nothing quite like this.

    Thank you for the help

  • The topic ‘Styling current post link in sidebar’ is closed to new replies.