Add class to active top level (grandparent) menu item

Styling the top-level item if it’s active or a child is active is possible with pure CSS. Use the child selector, >, from the top: .sidebar-navigation > ul > .current-menu-item, .sidebar-navigation > ul > .current-menu-ancestor {} If you want to add a new class, you can use the nav_menu_css_class filter. One of its parameters is … Read more

Get only the path from a function like previous_post_link

Add following function in your functions.php file. function custom_post_link($format, $link, $in_same_cat = false, $excluded_categories=””, $previous = true) { if ( $previous && is_attachment() ) $post = & get_post($GLOBALS[‘post’]->post_parent); else $post = get_adjacent_post($in_same_cat, $excluded_categories, $previous); if ( !$post ) return; $link = get_permalink($post); $format = str_replace(‘%link’, $link, $format); $adjacent = $previous ? ‘previous’ : ‘next’; echo … Read more

Bar separated navigation by extending Walker_Nav_Menu

You can use the menu order inside the item to see if it’s not first. If it isn’t have it draw the character before the anchor. class Bar_List_Walker_Nav_Menu extends Walker_Nav_Menu { private $separator = ” | “; function start_el(&$output, $item, $depth, $args) { if($item->menu_order > 1){ $output .= $this->separator; } $attributes = ! empty( $item->target … Read more

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

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