I've been looking to the answers on this site, but they lack information on what files to edit and/or the path to them, and where or how you activate and can see the changes.
For example, this question:
Edit html for menu items in default frontend menu
or this:
https://wordpress.stackexchange.com/a/64034/166781
I want to add my custom html items in the nav menu, and I guess that I have to add my code, in this case copied from the questions and answers provided here, to functions.php
, but I can't see any change anywhere.
As an example, if I want to add an item to de nav menu like the code below (taken from one of the question I posted):
add_filter('wp_nav_menu_items', 'wps_add_login_logout_link', 10, 2);
function wps_add_login_logout_link($items, $args) {
$login = __('Sign in');
$logout = __('Sign out');
$menu_id = '15';
$menu_id2 = '16';
if ( ! is_user_logged_in() )
$link = '<a href="' . site_url('log-in-log-out') . '">' . $login . '</a>';
else
$link = '<a href="' . wp_logout_url('log-in-log-out') . '">' . $logout . '</a>';
if ( $args->menu == $menu_id )
$items .= '<li>'. $link .'</li>';
elseif ( $args->menu == $menu_id2 )
$items .= '<li>'. $link .'</li>';
return $items;
}
Which file should I add this?
Once added, where can I see the changes made effect?
Thanks for your patience.