ThemeShaper Forums » Thematic

[closed]

Show category menu across site

(20 posts)
  • Started 4 years ago by raquelwilson
  • Latest reply from helgatheviking
  • This topic is resolved
  1. Hello all:

    What is the best way to edit the following code so that category menu shows up on all pages? Right now it only shows on the home page. TIA

    // Add a drop down category menu
    function childtheme_category_menu() { if(!is_page()) { ?>
        <div id="category-access">
            <div id="category-menu" class="menu">
                <div class="menu-title"><?php _e('Featured Projects', 'thematic'); ?></div>
            </div>
        </div>
    <?php } }
    add_action('thematic_belowheader','childtheme_category_menu', 5);
    Posted 4 years ago #
  2. I second this request.

    Is it something that could be built into the Thematic Options for those who own Power Blog?

    Tom

    Posted 4 years ago #
  3. // Add a drop down category menu
    function childtheme_category_menu() {  ?>
        <div id="category-access">
            <div id="category-menu" class="menu">
                <div class="menu-title"><?php _e('Categories:', 'thematic'); ?></div>
                <ul id="category-nav" class="sf-menu">
                    <?php wp_list_categories('title_li='); ?>
                </ul>
            </div>
        </div>
    <?php }
    add_action('thematic_belowheader','childtheme_category_menu', 5);
    Posted 4 years ago #
  4. Works like a charm.

    Thanks a lot Manuel!

    Posted 4 years ago #
  5. Similarly - is it possible to make the category menu a true dropdown with flyouts like the page menu? (ie, Not listed in a horizontal bar), thus mixing Pages and Categories in the same top level navigation.

    thx!

    Posted 4 years ago #
  6. Ugh... so close - this ALMOST works.

    function childtheme_category_menu() {
    ?>
    <div id="category-menu">
    <ul class="sf-menu">
    <?php wp_list_categories('orderby=name&amp;amp;exlude=181&amp;amp;title_li=');
    $this_category = get_category($cat);
    if (get_category_children($this_category->cat_ID) != "") {
    echo "<ul>";
    wp_list_categories('orderby=id&amp;amp;show_count=0&amp;amp;title_li=&amp;amp;use_desc_for_title=1&amp;amp;child_of='.$this_category->cat_ID);
    echo "</ul>";
    }
    ?>
    </ul>
    </div>
    <?php
    }
    add_action('thematic_belowheader','childtheme_category_menu', 5);
    Posted 4 years ago #
  7. This is cleaner, but it's still not replacing the top level < ul > nav item's < li >s - instead, it's just adding (as requested, I suppose) at the 'thematic_belowheader'.

    function childtheme_category_menu() {
    ?>
    <div class="menu">
    <ul class="sf-menu">
    <?php wp_list_categories(); ?>
    </ul>
    </div>
    <?php
    }
    add_action('thematic_belowheader','childtheme_category_menu', 5);
    Posted 4 years ago #
  8. OK - No takers?

    How about a different approach? The WPML SitePress Plugin does a lot of what I'm looking for with regards to mixing pages and categories into the same navbar area. (The plugin is really overkill for just swapping menu stuff, but I've yet to find anything to do what I need.)

    So... any ideas of how to switch out the thematic_access() stuff with this plugin call?
    <?php do_action('icl_navigation_menu'); ?>

    I really don't want to lose all the nice thematic and superfish menu stuff, but I really need these menu pages and categories to intermingle. (It's a shame Wordpress doesnt have the ability to mix pages, categories, posts, tags et al by default.

    thx!

    Posted 4 years ago #
  9. Unfortunately you can't have both. Here's the code for your child theme's functions.php to swap the menu:

    function remove_access() {
    	remove_action('thematic_header','thematic_access',9);
    }
    add_action('init', 'remove_access');
    
    function my_access() {
    	do_action('icl_navigation_menu');
    }
    add_action('thematic_header','my_access',9);

    You need to adjust the CSS settings for the menu.

    Cheers,

    Chris

    Posted 4 years ago #
  10. Thanks Chris! Works perfectly as expected :)

    Posted 4 years ago #
  11. likethegoddess
    Member

    Firstly, thanks for putting all of your heads together on this.

    This thread looks closest to the solution I'm looking for. Unfortunately, none of the options above are working for me so far and I'm very new to Thematic and to PHP.

    To clarify, I want to keep the page menu, which I've styled to the upper right corner of my header. I want to add a category menu, at the bottom of the header, that displays throughout the site.

    Any other ideas?

    Posted 4 years ago #
  12. Hi,

    take Manuel's code:

    // Add a drop down category menu
    function childtheme_category_menu() {  ?>
        <div id="category-access">
            <div id="category-menu" class="menu">
                <div class="menu-title"><?php _e('Categories:', 'thematic'); ?></div>
                <ul id="category-nav" class="sf-menu">
                    <?php wp_list_categories('title_li='); ?>
                </ul>
            </div>
        </div>
    <?php }
    add_action('thematic_belowheader','childtheme_category_menu', 5)

    Change the priority 5 to 10.

    Chris

    Posted 4 years ago #
  13. likethegoddess
    Member

    Thanks, I'll give that a shot.

    Posted 4 years ago #
  14. B.B.
    Member

    I tried Manuel/Chris' suggestion above (changing the 5 to 10) and it worked! Thanks!

    Posted 4 years ago #
  15. Yay, my problem was solved by you guys on beforehand. I ended up mixing a couple of the suggestions, and made this:

    function remove_access() {
    	remove_action('thematic_header','thematic_access',9);
    }
    add_action('init', 'remove_access');
    
    function my_access() { ?>
    	<div id="category-access">
            <div id="category-menu" class="menu">
                <ul id="category-nav" class="sf-menu">
                    <?php wp_list_categories('title_li='); ?>
    
            </div>
        </div>
    <?php }
    add_action('thematic_header','my_access',10);

    And it did the trick! :)

    Posted 4 years ago #
  16. And how about the other way around. To not showing the categories at all in the mail horizontal menu?

    Posted 3 years ago #
  17. So, just to clarify, there is no way to display pages and categories as "equals" in the menu?

    Posted 3 years ago #
  18. logostar
    Member


    Posted 2 years ago #
  19. logostar
    Member

    I think the only way to [to display pages and categories as "equals" in the menu] is to build it by hand. -Too much work!

    However... because it is built with php (learning) its all the more difficult.

    Posted 2 years ago #
  20. you can add categories via the custom menu feature, but doing it all automatically sounds difficult

    Posted 2 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.