I want to have 'Text only' in menu of my wordpress website without plugin.So how to set dynamic link to menu item in wordpress?
Asked
Active
Viewed 2,960 times
2 Answers
1
try this one
add_filter('wp_nav_menu_items', 'menu_link', 10, 2);
function menu_link($items, $args) {
if ($args->menu == 'footer'){
$items .= '<li class="copyright "><a href="' . get_permalink()."/?text=1" . '">Text Only</a></li>';
$items .= '<li class="copyright "><a href="' ."print.php"."?Page=".get_the_ID().'">Print Page</a></li>';
}
return $items;
// return $items1;
}

Nisarg Thakkar
- 1,497
- 16
- 25
0
You will have to recreate the complete menu walker to make it text only, or remove the anchor through jquery. But if you just want a menu item that doesn't link anywhere, create a normal link menu item, and instead of an actual link use #.

Omer Farooq
- 3,754
- 6
- 31
- 60