开发者

Wordpress - Adding class to the href in the using wp_nav_menu

开发者 https://www.devze.com 2023-03-23 21:31 出处:网络
I was wondering if its possible to add a class for the current page to the href tag instead of the li tag that wordpress开发者_Python百科 uses by default.

I was wondering if its possible to add a class for the current page to the href tag instead of the li tag that wordpress开发者_Python百科 uses by default.

By menu arguments are as follows:

<?php wp_nav_menu( array( 
    'theme_location'    => 'main-menu',
    'container'         => '',
    'menu_class'        => '',
    'menu_id'           => 'nav'
) ); ?>

Cheers,


why do you want to do this? you can access the A in css using something like this:

#nav li.current-menu-item a {
  text-decoration:underline;
}

what exactly do you want to achieve?

0

精彩评论

暂无评论...
验证码 换一张
取 消