ThemeShaper Forums » Thematic

[closed]

Call Specific Menu to top of Screen

(6 posts)
  • Started 3 years ago by sfrangos
  • Latest reply from em hr
  • This topic is not resolved
  1. Hello Colleagues -

    A few months back, Chris posted the following code about how to move a menu to the top of the screen by adding the code to functions.php:

    // remove the menu from its old position
    function remove_access() {
    remove_action('thematic_header', 'thematic_access', 9);
    }
    add_action('init', 'remove_access');
    // add menu to its new position
    add_action('thematic_header', 'thematic_access', 0);

    Thanks Chris. NEW QUESTION: For WP 3, how do we designate a specific menu for that location? For example, if we intend to use more than one menu, how can we make certain it is the menu named "primary" that appears in that position?

    Thanks -
    Scott

    Posted 3 years ago #
  2. check out: http://justintadlock.com/archives/2010/06/01/goodbye-headaches-hello-menus

    hope that helps.

    Posted 3 years ago #
  3. Hi Scott,

    With Thematic 0.9.7.3 (by default) it is certain the the "primary" menu will only appear in the access div.

    It registers only one menu with an id of primary-menu and includes it for use inside thematic_access()

    Look in thematic>library>extensions>header-extensions.php at these three functions

    thematic_nav_menu_args()
    thematic_init_navmenu()
    thematic_access()

    Here are the filter hooks to look at using:

    thematic_menu_type
    thematic_primary_menu_id
    thematic_primary_menu_name

    Be careful with thematic_primary_menu_id because it shared between thematic_init_navmenu() &
    thematic_access() it will not only change the menu used in the access div but it will register it as well. If you want to change the name of this menu then thematic_primary_menu_nam is the filter to use.

    I hope this isn't too too confusing.

    -Gene

    Posted 3 years ago #
  4. Hi -

    Thanks for the replies. If I understand you correctly, Gene, the above code that Chris originally posted will call only the Primary menu into place at top of header. Then, to call a different one into another place in the theme, we would use: thematic_primary_menu_name

    - Scott

    Posted 3 years ago #
  5. Robo
    Member

    This seems to work for me to use the custom menu:

    // Remove Thematic Access
    function remove_thematic_actions() {
    remove_action('thematic_header','thematic_access',9);
    }
    add_action('init','remove_thematic_actions');

    function my_menu() { /* display the custom menu -- struth, it works!!! */
    wp_nav_menu( array('menu' => 'Custom Menu' ));
    }
    add_action('thematic_header', 'my_menu', 9);

    Posted 3 years ago #
  6. Scott,

    Explaining this is semantically difficult.

    thematic_init_navmenu() only registers a theme menu location.

    This location is named the "Primary Menu" and is the one used by thematic_access() if a custom menu has been created and assigned to it using WP-dmin>Appearance>Menus>Theme Locations

    The "Theme Location" input box does not even appear on the WP-Admin>Appearance>Menus screen until you have created a menu. So if you have not created at least one custom menu in the admin, you should so that you see what I'm talking about.

    If you have registered more menu locations in your child theme and later hooked them into Thematic or called them from your templates, then you can make as many menus as you like and put them in whatever "Theme Location" you like using the admin.

    So in answer to: "how do we designate a specific menu for that location"?
    You do so by creating menus and using WP-Admin>Appearance>Menus>Theme Locations to connect the desired menu to your desired menu location.

    and "how can we make certain it is the menu named "primary" that appears in that position"?

    Assuming you have a function like this one included in you child theme's functions.php:

    function child_access_navmenu() {
    	return "wp_nav_menu";
    }
    add_filter('thematic_menu_type', 'child_access_navmenu');

    Then whatever menu you assign to the "Primary Menu" location in Thematic will show up wherever thematic_access() is hooked or re-hooked as it may be.

    -Gene

    Posted 3 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.