If child is active add class to parent in customWalker

By default, WordPress applies ancestor classes to the parents of active items. All you have to do is target them via CSS: .nav-menu li.current_page_ancestor > a, .nav-menu li.current-menu-ancestor > a {} This code sample implies that your menu has the .nav-menu class. This will work with a navigation menu and with the page menu fallback.

wp_nav_menu with WP as pure CMS

I know I can change WP to use nice permalinks to get www.example.com/wordpress/about but I’d like to customise it further so that the link would read www.example.com/about e.g. skip the wordpress install location. Rather than “skipping the location”, point your domain to the location. Or install WP to your root, respectively. You could obviously do … Read more

add_menu_page does not render the expected result

as the 5 parameter to add_menu_page() you send the resultat of running the function, insted of sending a callable reference to the function, as you did in the add_action. $hookname = add_menu_page ( ‘My Slider’, ‘My Slider’, ‘manage_options’, ‘my_slider’, array( ‘My_Slider’, ‘render_admin_menu’) );

Add pages content to startpage through custom menu

You can use get_nav_menu_locations and wp_get_nav_menu_items to get your menu items. $locations = get_nav_menu_locations(); $nav_items = wp_get_nav_menu_items($locations[‘your-menu-slug’]); You can then process $nav_items to display your page content. It can get complicated but it does work.

how to check if given page is active page

Use get_the_ID() before you start the loop, then compare: $original_id = is_singular() ? get_the_ID() : 0; $args = array(‘post_type’ => ‘services’); $services = new WP_Query( $args ); $cnt = 0; if( $services->have_posts() ) { while( $services->have_posts() ) { $services->the_post(); if ( get_the_ID() === $original_id ) echo ‘This is me!’;

Display pictures instead of text in menus

This would be my solution to the problem if you want to make edits on the back-end(Admin area) in the site at any time. If you want a static menu just insert step 1 where you needed it and skip the rest. Hope it helps! Your CODE will look similar to this: Step 1) Create … Read more

Wp Nav Menu div containers

From what you described, it sounds like you might need to use a custom walker for the wp_nav_menu call. To create a custom walker that modifies the wrapper for dropdown lists, start with this class: <?php class wpse_112127_walker extends Walker_Nav_Menu { function start_lvl( &$output, $depth ) { $indent = str_repeat(“\t”, $depth); $output .= “\n” . … Read more