add pagination as per wp nav menu

Posted: September 28, 2015 in Uncategorized
Tags: , ,

****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 } ?>


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s