How to Overwrite/Customize wp-admin/nav-menus.php in WordPress
this can be done with the “add_menu_page” function you can see example of use on this page : http://codex.wordpress.org/Function_Reference/add_menu_page
this can be done with the “add_menu_page” function you can see example of use on this page : http://codex.wordpress.org/Function_Reference/add_menu_page
You can take the following steps Go to You Dashboard Click Appearance > Menus Under Pages, Click View All There will be a ‘Home’ option Check that Home Option Click ‘Add to Menu’ The new Menu item will appear in the right block Drag the home menu to the top Save the menu
You are not providing the correct parameter to wp_get_nav_menu_object() function. It needs the menu ID or menu slug but you are providing the menu theme location. Obviously, I can not tell you what is the ID or slug of your menu. One way of getting the menu ID of the menu assigned to theme location … Read more
Not sure why your object is returning the non-object notice, but you can set the output of get_term_by to OBJECT, ARRAY_A, or ARRAY_N – You’ll want to use ARRAY_A and then access the term ID via $term[‘term_id’].
I’m making some assumptions here, like you are the one writing the code for the theme, or at least have the ability to modify the JavaScript in some way. You can accomplish this using jQuery using code along these lines: $(document).ready(function () { $(‘.parent ul’).slideUp(); $(‘.parent > li > a’).on(‘click’, function (e) { e.preventDefault(); var … Read more
Instead of using a Walker in this instance you can use the items_wrap parameter of wp_nav_menu. $args = array( ‘container’ => ‘nav’, ‘container_class’ => ‘c-nav c-nav–vertical c-nav–collapsible’, ‘menu_class’ => ‘c-nav__collapser’, ‘theme_location’ => ‘secondary’, ‘items_wrap’ => menu_wrapper() ); wp_nav_menu($args); In the called function you can use the arguments for %1$s (id), %2$s (class), and %3$s (all … Read more
The helpers you’ll need are wp_create_nav_menu() and wp_update_nav_menu_item(). This will allow you to create a menu and then, using a query posts loop, programmatically add every page in your site dynamically. You can use the get_pages() helper to retrieve all pages from the DB. <?php // These are default args and don’t need to be … Read more
You can use is_page( $tpl->ID ) || is_single( $tlp->ID ) which will cover posts, pages and custom post types. For the archive link, use is_post_type_archive( $post_type ). If you need it highlighted for single posts of the same type, add || is_singular( $post_type )
A good place to start learning how this stuff works in WordPress is to get familiar with the WordPress Documentation which is lovingly referred to as The Codex. The answer to your question will become very clear once you understand how The Loop works. If I am understanding your question clearly enough I think that … Read more
To be able to change the Link, you can hook into the nav_menu_link_attributes filter. if ( ! function_exists( ‘wpse_209457_nav_menu_link_attributes’ ) ) { function wpse_209457_nav_menu_link_attributes( $atts, $item, $args ) { if ( ‘primary-menu’ == $args->theme_location ) { // Get the target posts slug $object_data = get_post( $item->object_id ); $atts[‘href’] = ‘#’.$object_data->post_name; return $atts; } } } … Read more