ThemeShaper Forums » Thematic

[closed]

Categories in Header

(10 posts)
  • Started 11 years ago by aquaman
  • Latest reply from atlepe
  • This topic is not resolved
  1. aquaman
    Member

    By default the theme is setup to navigate using pages. I would like to change this in the Child Theme to navigate using categories. Can someone please help. Thanks.

    Posted 11 years ago #
  2. Hey,

    add the following code to your child theme's functions.php:

    // remove thematic_access()
    function remove_access() {
    	remove_action('thematic_header','thematic_access',9);
    }
    add_action('init', 'remove_access');
    
    function my_access() { ?>
        	<div id="access">
        		<div class="skip-link"><a href="#content" title="<?php _e('Skip navigation to the content', 'thematic'); ?>"><?php _e('Skip to content', 'thematic'); ?></a></div>
        			<ul id="#nav" class="sf-menu">
                <?php wp_list_categories('title_li='); ?>
            	</ul>
            </div><!-- #access -->
    <?php }
    add_action('thematic_header','my_access',9);

    remove_access() will remove the original thematic_access() from the thematic_header() hook.

    my_access() recreates the menu using a category list.

    Tested and approved using Thematic 0.9 and a basic child theme found in thematic\thematic-sample-child-theme.

    Cheers,

    Chris

    Posted 11 years ago #
  3. Is it possible to have the nav bar mix both pages and categories?

    Would be a really nice feature to have, especially if the categories had the same superfish ability that pages currently do, and could update automatically.

    Thanks,
    Tom

    Posted 11 years ago #
  4. Hey Tom,

    you can either add pages and use the plugin "Page Links To" to connect the page to a category (no automatic updates) or you could rebuild the menu using wp_list_pages() and wp_list_categories(). The last one includes automatic updates but it will always be Pages + Categories. I haven't found anything to really mix both of them together, do a sort and display a mixed menu.

    Cheers,

    Chris

    Posted 11 years ago #
  5. antoniothonis
    Member

    What i'd like to have is a banner that has underneath it the categories menu, the pages menu would be nice in the top right corner. Then on each categories page a start posts that explains this category incl images. Ander under that the normal posts.

    How can i achieve this? I put in the code u pasted btw. Works well only problem its totaly aligned to the left side of the page.

    Posted 11 years ago #
  6. I've successfully set it up, per the above, so that categories are the top navigation.

    QUESTION: How can I reorder how they're listed, or exclude certain categories.

    Thanks!

    Tim

    Posted 10 years ago #
  7. That would be controlled by the arguments passed to the wp_list_categories function. To find out how to accomplish your goal look to the codex page on wp_list_categories

    -Gene

    Posted 10 years ago #
  8. atlepe
    Member

    I'm having the same problem as antoniothonis, the code provided by Chris worked well, but they are aligned to the far left of the page. Anyone know how I can position them where the pages where located, i.e. aligned with the header and content?

    Posted 10 years ago #
  9. atlepe, wouldn't CSS edit be enough for what you are asking for?

    Posted 10 years ago #
  10. atlepe
    Member

    Probably, I have been using the firebug extension for firefox to edit the theme and see the changes, I am able to make changes to the navbar from default.css in the library folder under thematic, I can change fonts and borders, but I can't move it.

    I don't really know much about css or php, so this is kinda beyond my scope right now.

    In other words; I'm stumped...

    Posted 10 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.