How to order adjacent posts (prev / next) by custom field value?

You can filter SQL to change to your condition in get_adjacent_post() ( source ) : $sort = apply_filters( “get_{$adjacent}_post_sort”, “ORDER BY p.post_date $order LIMIT 1” ); Or filter link altogether in adjacent_post_link() ( source ) : echo apply_filters( “{$adjacent}_post_link”, $format, $link ); PS $adjacent can be next or previous.

Show current navigation path from menu

The best way would be to use wp_nav_menu with a custom walker. Prerequisites: Registered theme location Menu saved to that theme location Useage Wherever you want the breadcrumbs (for theme location ‘primary’): <?php wp_nav_menu( array( ‘container’ => ‘none’, ‘theme_location’ => ‘primary’, ‘walker’=> new SH_BreadCrumbWalker, ‘items_wrap’ => ‘<div id=”breadcrumb-%1$s” class=”%2$s”>%3$s</div>’ ) ); ?> The custom walker … Read more

Removing link ” from ” menu for some “links” without JS

Assuming you’re using wp_nav_menu() to display your navigation you could apply a walker that looks for css classes: $items_wrap = ‘<nav class=”…”>’; $items_wrap .= ‘<ul id=”%1$s” class=”%2$s”>%3$s</ul>’; $items_wrap .= ‘</nav>’; wp_nav_menu( array( ‘container’ => false, ‘container_class’ => false, ‘menu_class’ => ‘…’, ‘echo’ => true, ‘before’ => ”, ‘after’ => ”, ‘link_before’ => ”, ‘link_after’ => … Read more

Show just one level of child pages, wp_list_pages woe

This should work, using nothing more than the available argument-array parameters for wp_list_pages(): specifically, depth and child_of. To display one level of hierarchy, for descendant pages of the current page: <?php // Globalize the $post variable; // probably already available in this context, but just in case… global $post; wp_list_pages( array( // Only pages that … Read more

Add Dividers or Separators Between Nav Menu Items

Use a custom walker. Extend start_el() to print <li class=”menu_separator”><hr></li> if the menu title is just a ‘-‘. functions.php function wpse38241_setup_menu() { register_nav_menu( ‘main-menu’, ‘Main Menu’ ); } add_action( ‘after_setup_theme’, ‘wpse38241_setup_menu’ ); /** * Replaces items with ‘-‘ as title with li class=”menu_separator” * * @author Thomas Scholz (toscho) */ class Wpse38241_Separator_Walker extends Walker_Nav_Menu { … Read more

Add custom meta to nav menu items

here is a quick code that should do the job, paste this in your theme’s functions.php file basically what it does is hide all regular class input boxes and adds a new select dropdown which changes the value of the hidden input based on the selected value. and it looks like this; function menu_item_class_select(){ global … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)