Advertisement
hendrajeg

Add menu active to single post

Aug 8th, 2022
1,356
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 0.40 KB | None | 0 0
  1. jQuery(function($) {
  2.     $( document ).ready(function() {
  3.         if ($('body').hasClass('single')) {
  4.             var category = $('.jeg_meta_category a:first').text()
  5.                 if ( category.length ) {
  6.                     var dumb = $(".jeg_main_menu").find('a:contains(' + category + ')')
  7.                     dumb.parent('li').addClass('current-menu-item')
  8.                 }
  9.         }
  10.     });
  11. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement