WP Walker using custom css classes

Not sure you want to do it like this, but just in case, you can use the filter nav_menu_css_class : function my_special_nav_class( $classes, $item ) { if ( is_single() && $item->title == ‘Blog’ ) { $classes[] = ‘special-class’; } return $classes; } add_filter( ‘nav_menu_css_class’, ‘my_special_nav_class’, 10, 2 ); You’ll find more example here

How do I Add HTML to the_excerpt() & the_content() Output?

get_the_excerpt() returns the excerpt, but only after applying get_the_excerpt filters to it. This causes infinite recursion, as your filter handler will be called to an infinite depth. Of course, the best solution is the css one (see @spacegrrl’s answer), but if you have your reasons for keeping that <span>, please note that the excerpt can … Read more

WP-PageNavi is showing the first page only

In case of wp_query, you can’t use shortcode this way <?php wp_pagenavi(); ?> You need to use variable (in which you are storing wp_query) in array inside shortcode. Use shortcode like this instead. Replace above shortcode with below one. <?php wp_pagenavi( array( ‘query’ => $query_slider ) ); ?> UPDATE This is a way in which … Read more

Add custom url to featured image

you can do this pretty simply. I’m guessing you are inside the wordpress loop. Basically, get the link url, get the image url, echo out. <?php $custom_link = the_field(‘custom_url’); //probably want to check if this is empty $post_thumb = get_the_post_thumbnail( $post_id );//you can pass size if you would like echo ‘<a href=”‘ . $custom_link . … Read more

How to Highlight unread WordPress posts?

You can use update_user_meta() and get_user_meta(), where you can store and retrieve a value related to a key and a user, like ‘read_post_’ . $post_id for example. Inside The Loop, when you’re going to print the article, you can add a condition: if the user has the user meta value ‘read_post_’ . $post_id as false … Read more