Posts Tagged ‘wp nav menu’

****WP MENU NAVIGATE/Pagiantion****************/
$locations = get_nav_menu_locations();

$menu = wp_get_nav_menu_object($locations[‘primary’]);  //Get menu items that menu location is set to ‘primary’
$menuitems = wp_get_nav_menu_items( $menu->term_id, array( ‘order’ => ‘DESC’ ) );

foreach ( $menuitems as $item ){
if($item->type !=’custom’){
$id = get_post_meta($item->ID,’_menu_item_object_id’,true).'<br />’;
$page = get_page($id);
$link = get_page_link($id);

if ($id==$post->ID){
echo ‘previd :’.$previd=$i-1;


if (empty($nextid)){
if (empty($previd)){
<a href=”<?php echo $nextid; ?>”>Next Item</a>
<?php if($previd>0){ ?>
<a href=”<?php echo $previd; ?>”>Previous Item</a>
<?php } ?>


Hi all,

recently I just try to add class in li tag in wp nav menu.After some search I got this:

Filter Name : nav_menu_css_class


function li_class($classes, $item, $args) {
$classes[] = ‘YOUR_CLASS_NAME’;  // add our class name
return $classes;