Highlight visible post in archive.php
-
Hello. Sorry having a bit of trouble with my dynamic highlight on my menu.
In my archive.php I am showing the list of projects within the category and showing the most recent post.
I am able to call up the visible posts ID and use it as $post_id
The menu highlights the current single post using
if ( is_single(“$post->ID”But I need a
if ( **visiblepost**(“$post_id”)Anyone have any ideas? The code I am using is shown below.
<li <?php
//gets shown post ID
global $wp_query;
$post_id = $wp_query->post->ID;
//highlights current post id. shown post in archive not working!!!!
if ( is_single(“$post->ID”) || the_post(“$post_id”) ) { echo ‘ class=”current_page_item”‘; } ?>>
“><?php the_title(); ?>
- The topic ‘Highlight visible post in archive.php’ is closed to new replies.