Custom Class to wp nav menu

This is an old question, but might be very much relevant still today so I thought I would drop a piece of code I developed over the years. It’s basically as close as you can get to customizing classes on every element of a menu in WordPress without developing a custom Nav Walker. This is … Read more

adding a numbers to a item from navigation menu

You can target the location like this: function wpa_filter_nav_menu_objects( $items, $args ){ if( $args->theme_location === ‘primary’ ){ foreach( $items as $item ){ if( strtolower( $item->title ) === ‘sample page’ ){ $item->title = $item->title . ‘(10)’; } } } return $items; } add_filter( ‘wp_nav_menu_objects’, ‘wpa_filter_nav_menu_objects’, 10, 2 ); You can also try $args->menu_id if you use … Read more

Returning website screenshot based on Custom Field

i think there is an error – <img src=”https://wordpress.stackexchange.com/questions/105525/<?php echo”http://s.wordpress.com/mshots/v1/’.urlencode(the_field(‘website’); ‘).’?w=200′ ?>” /> it should be <img src=”https://wordpress.stackexchange.com/questions/105525/<?php echo”http://s.wordpress.com/mshots/v1/’.urlencode(the_field(‘website’).’?w=200′ ?>” alt=”” /> And if this not work. I think you use the_field(‘website’) function which actually not return result you can try this code. <img src=”https://wordpress.stackexchange.com/questions/105525/<?php echo”http://s.wordpress.com/mshots/v1/’.urlencode(get_the_field(‘website’).’?w=200′ ?>” alt=”” />