Jump links to another page and return back to the first page anchors successfully
You can use it like this http://wwww.yoursite.com/#anchor from another page.
You can use it like this http://wwww.yoursite.com/#anchor from another page.
To get a working nav menu WordPress needs to be set up complete. My suggestion is to use add_feed(). Ignore the name, you get text/html as output. Let’s start with code <?php # -*- coding: utf-8 -*- /* Plugin Name: T5 Iframe Nav Menu Description: Display a nav menu in an iframe. Version: 2012.05.18 Refresh … Read more
function wpb_list_child_pages() { global $post; $parent = “”; if ( is_page() && $post->post_parent ) { $parent = wp_list_pages( ‘title_li=&include=” . $post->post_parent . “&echo=0’ ); $childpages = wp_list_pages( ‘sort_column=menu_order&title_li=&child_of=” . $post->post_parent . “&echo=0’ ); } else { $childpages = wp_list_pages( ‘sort_column=menu_order&title_li=&child_of=” . $post->ID . “&echo=0’ ); //$parent = $post->post_title; } if ( $childpages ) { $string … Read more
Here’s 2 options: First: The code goes in your child themes functions file and creates one extra menu which displays in the genesis_after_header position. There are 2 steps needed to add new nav menus. One. Register the menu(s) using the init action hook NOT after_theme_setup Two. Hook the menu into a theme hook location ( … Read more
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
Within each menu item, object_id holds the ID of whatever object the menu item refers to. This will be a post / page / CPT / term ID. If it’s a custom link, the ID refers to itself. (If you want to know what type of object it is, object contains that.) get_queried_object_id() will give … Read more
For flexibility, you could assign the CSS bubblecount class to the corresponding menu item: and then target it with: if( in_array( ‘bubblecount’, (array) $item->classes ) ) $output .= ‘<span class=”unread”>’.my_function_here().'</span>’; in your code snippet above.
I can see a syntax error: replace ‘theme-location’ by ‘theme_location’. Always think about underscores in WordPress variables/functions names 😉 wp_nav_menu() : https://codex.wordpress.org/Function_Reference/wp_nav_menu
Funny, I just ran into this same conundrum a few months back… Background I found it quite bizarre that WordPress applies all manner of CSS classes to menu-items in order to distinguish the current item and its ancestors, but then completely ignores the sub-menus and their relationship with the current item. I wanted a .current-sub … Read more
Use a custom walker. Extend the functions start_lvl() and end_lvl(): class WPSE39005_Div_Walker extends Walker_Nav_Menu { /** * @see Walker::start_lvl() * * @param string $output Passed by reference. Used to append additional content. * @return void */ public function start_lvl( &$output, $depth ) { $output .= ‘<div><ul class=”sub-menu”>’; } /** * @see Walker::end_lvl() * * @param … Read more