Hi there,
I wish to do the same thing than adubwood(@adubwood) does above. So I tried to use the snippet Bill’s kindly provided : I downloaded Code Snippets plugin and pasted the piece of code inside. So far so good but…
As I can hardly understand php syntax, I’m unable to make the code fit to my own requirements and that’s doesn’t work… Yep, I’m more on the design side, comfortable with HTML and CSS but not at all with any code ??
This is the loop used to retrieve the posts :
`<ul>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<li class=”post-list-item”>
<a href=”<?php the_permalink(); ?>”><?php get_the_title() ? the_title() : the_ID(); ?></a>
<?php if ( $instance[‘show_date’] ) : ?>
<span class=”post-date”><?php echo get_the_date(); ?></span>
<?php endif; ?>
</li>
<?php endwhile; ?>
</ul>`
The <li class=”post-list-item”> is the one I want to add a “my_current” class when the post’s title matches the list-item in my menu.
I hope I made myself clear, many thanks if you can help, feel free to ask for more infos if needed !
-
This reply was modified 5 years, 1 month ago by pixys.