• Resolved barkins

    (@barkins)


    WordPress generates a class for the highlighted category using… <?php wp_list_categories(‘title_li=’); ?>

    How do I do the same with recent posts?

    Thanks

Viewing 1 replies (of 1 total)
  • Thread Starter barkins

    (@barkins)

    Here’s how it’s done in case you want to know….

    <?php

    $IDOutsideLoop = $post->ID;
    global $post;

    $myposts = get_posts(‘showposts=10’);
    foreach($myposts as $post) :
    ?>

    <li <?php if(is_single() && $IDOutsideLoop == $post->ID) print ‘class=”current_post”;’ ?>>“><?php the_title(); ?>

    <?php endforeach; ?>

Viewing 1 replies (of 1 total)
  • The topic ‘How to highlight recent post currently viewing?’ is closed to new replies.