Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Adding a submenu in the sidebar for a specific page

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #30942
    Kralle
    Participant

    Hello there! :-)

    I’m working on a site, and I’m new to WordPress. I’ve spent hours on Google trying to find a solution to my problem, but I honestly don’t know how to fix this. I’m looking for a way to add a submenu in the sidebar to a specific page. I could imagine, I’d have to use the built-in-Wordpress custom navigation menu and perhaps set up two types of menus, which I’ve done here in the functions.php-file:

    if ( function_exists( 'register_nav_menus' ) ) {
    register_nav_menus(
    array(
    'menu' => 'Menu',
    'submenu' => 'Sidebar submenu'
    )
    );
    }

    In the header.php I’ve written the following:

    			

      'menu_order', 'container_id' => 'topmenu', 'theme_location' => 'primary', 'link_before' => '', 'link_after' => '' ) ); ?>

    … and it works perfectly with the CSS, except for the fact that the submenu-item is still stuck at the #topmenu. I’m sure I’d have to put something in the sidebar.php to let the links to the “children” pages of the parent page show there, but I don’t know what to put in sidebar.php. This of course means that I’ve set the submenu-pages to be a child of the parent page in the Dashboard’s page-overview-options. I also need the sidebar-submenus to contain some sort of id or class, since I’m styling them via CSS.

    I’d love to get some help on this. Thanks in advance,
    Kralle

    #70153
    Kralle
    Participant

    I’m sorry to bump this, but I cannot figure out what to do. Can anyone help me?

    #70118
    jamygolden
    Member

    You could give the page a special page template. For example, ‘contact.php’

    
    if ( is_page_template('contact.php') ) {
    // Do whatever
    }
    ?>
    #70119
    Jacek
    Member

    And is there a way that I set “Page Sidebar” with my custom menu in the widgets and it appears only when I’m on “some_site”? If so, what should I write in the code? I have been trying for some time but some strange things and errors appear?

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘Back End’ is closed to new topics and replies.