Customizing Walker_Nav_Menu

You just need to create your own walker class and extend start_el method. This method builds a link and you will be able to add your span before it: class Wpse8170_Menu_Walker extends Walker_Nav_Menu { var $number = 1; function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { $indent = … Read more

How to make Next and Previous attached image navigation on the attachment page? [duplicate]

Use previous_image_link and next_image_link in a image.php or attachment.php file. <nav id=”image-navigation” class=”navigation image-navigation”> <div class=”nav-links”> <?php previous_image_link( false, ‘<div class=”previous-image”>’ . __( ‘Previous Image’, ‘$text_domain’ ) . ‘</div>’ ); ?> <?php next_image_link( false, ‘<div class=”next-image”>’ . __( ‘Next Image’, ‘$text_domain’ ) . ‘</div>’ ); ?> </div><!– .nav-links –> </nav><!– #image-navigation –> Source: Twenty Fourteen

Using FlexNav with WordPress [closed]

You don’t need a custom walker function. You can alter wp_nav_menu like this: wp_nav_menu( array( ‘theme_location’ => ‘primary’, ‘menu_class’ => ‘flexnav’, //Adding the class for FlexNav ‘items_wrap’ => ‘<ul data-breakpoint=”800″ id=”%1$s” class=”%2$s”>%3$s</ul>’, // Adding data-breakpoint for FlexNav )); and proper script init should be: jQuery(document).ready(function($){ $(“.flexnav”).flexNav({ }); }); Drop menu button somewhere outside navigation: <div … Read more

Edit HTML of WordPress navigation bar

Yes, you’ll need to implement the walker class for this. Here is a simple example. $defaults = array( ‘theme_location’ => ‘primary’, ‘container’ => ‘ul’, ‘menu_class’ => ‘nav navbar-nav main-nav’, ‘walker’ => new Primary_Walker_Nav_Menu() ); wp_nav_menu( $defaults ); In the above block of code, the wp_nav_menu() function takes $defaults as argument. In the array $defaults, the … Read more

Prev/Next child navigation for current page?

All right, here it is, fully working: <?php $pagelist = get_pages(“child_of=”.$post->post_parent.”&parent=”.$post->post_parent.”&sort_column=menu_order&sort_order=asc”); $pages = array(); foreach ($pagelist as $page) { $pages[] += $page->ID; } $current = array_search($post->ID, $pages); $prevID = $pages[$current-1]; $nextID = $pages[$current+1]; ?> <div class=”navigation”> <?php if (!empty($prevID)) { ?> <div class=”previous”> <a href=”https://wordpress.stackexchange.com/questions/54422/<?php echo get_permalink($prevID); ?>” title=”<?php echo get_the_title($prevID); ?>”>Previous</a> </div> <?php } … Read more

Export navigation menu

WordPress has an Import/Export tool, but it doesn’t works with nav menus only, the “All Content” option will export the menus too, but with everything else that is in your site (including posts/pages in the trash) you can try this plugin so the Menu option shows in the Export page.