ThemeShaper Forums » Thematic

[closed]

Solution: Menu with certain Pages and Categories

(6 posts)
  • Started 13 years ago by JanTenner
  • Latest reply from helgatheviking
  • This topic is not resolved
  1. JanTenner
    Member

    Hi,
    I thought I post this here in case someone needs this - or maybe someone has a better solution for this.
    I want a menu with certain pages and categories as an item. This forum helped me out and I stiched some code together. I'd like to give credits but actually I dont know where I got it from. I use the Power Blog Theme as a child-theme and added this to solve my problem:

    // First we need to remove the action creating the menu
    function remove_access($content) {
    	remove_action('thematic_header','thematic_access',9);
    }
    add_action('init', 'remove_access');
    
    // Now we need to rebuild it
    function childtheme_access() { ?>
    		    	<div id="access">
    		    	      <div class="menu">
    <ul class="sf-menu">    <?php wp_list_pages('include=2,340,342,344,346,348&sort_column=menu_order&title_li='); ?>
    		                <?php wp_list_categories('include=21,1&title_li='); ?>
                </ul></div></div>
    		<?php }
    add_action('thematic_header','childtheme_access',9);
    Posted 13 years ago #
  2. Jopperdepopper
    Member

    Hi Jan,

    this seems to be just what I need, I only want to show my root-level pages in the main menu, and this could be a nice way to do just that.

    Only thing is, I'm fairly new to WP, and at the moment reading up on customising Thematic/child themes etc. I have experience with php/css, but have a hard time to wrap my head around existing frameworks like WP, because it's easier for me to just php/css myself :s

    My question is: where do I put this snippet of yours? Can I put it somewhere in a child theme? Or somewhere else?

    Posted 13 years ago #
  3. JanTenner
    Member

    Simply put in the functions.php in the child theme. Try the Power Blog child theme - and look at the functions.php there are a lot of comments that explains a lot.

    Posted 13 years ago #
  4. I also really like Menus Plus+ http://www.keighl.com/plugins/menus-plus/ for creating custom menus. You can put the custom menus you create in widgets, on pages or hook them into the template via your functions.php.

    Basically instead of:

    <?php wp_list_pages('include=2,340,342,344,346,348&sort_column=menu_order&title_li='); ?>
    		                <?php wp_list_categories('include=21,1&title_li='); ?>

    you'd put

    <?php menusplus(1); ?>

    Then you can control exactly which categories, pages, etc are in Menu #1 from your dashboard and not have to touch the functions file every time you need to tweak the menu.

    Posted 13 years ago #
  5. @helgatheviking: That sounds like a really good alternative :)

    Hopefully it will be much easier in the future with the wp-nav-menu option for WP 3.0+ The latest revisions of Thematic has (experimental) support for this menu.

    Posted 13 years ago #
  6. I thought so! Hope it helps you. A client needed to be able mod the menu from the dash w/o touching the theme (or atleast wants to know he can) but I didn't want to try to come up w/ my own solution when I know that menu control is in the pipeline for WP3.0 (and ummm that is sort of beyond me anyway!). I know it will be supported in Thematic once WP finalizes its code. Should be awesome.

    Posted 13 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.