ThemeShaper Forums » Thematic

[closed]

Menu navigation

(9 posts)
  • Started 9 years ago by brainsolid
  • Latest reply from em hr
  • This topic is resolved
  1. brainsolid
    Member

    Hello, everyone!

    I would like to change thematic menu, that show pages, to categories. So, i want view categories instead of pages. I don't need automatic output of categories, i can write categories ID's that i need manually. So, can you help me just find file that i must change and line in this file?

    Posted 9 years ago #
  2. Hello- brainsolid

    This is the way I like to do it.

    function remove_thematic_access() {
    remove_action('thematic_header','thematic_access',9);
    }
    add_action('init','remove_thematic_access');
    
    function my_category_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>
                <div class="menu">
                <?php wp_list_categories('title_li=Categories Rule:') ?>
                </div><!-- .menu -->
            </div><!-- #access -->
    <?php }
    add_action('thematic_header','my_category_access',9);
    
    function child_add_cat_menu($cat_menu) {
    
    	$search = array('/<li class="categories">/','/<ul>/',"/<\/li>$/");
    	$replace = array('<ul class="sf-menu"><li class="categories">','','');
    	return preg_replace($search, $replace, $cat_menu, 1);
    }
    add_filter('wp_list_categories','child_add_cat_menu');

    And style to match the li a's or whatever you like:

    .sf-menu .categories {
    	border-left:1px solid #ccc;
    	border-top:1px solid #ccc;
    	border-bottom:1px solid #ccc;
    	padding:9px 13px;
    	text-decoration:none;
    	}

    Then consult the codex on wp_list_categories to include or exclude or whatever you want.

    -Gene

    Posted 9 years ago #
  3. Oops- forgot to mention if you want to remove the category menu title the title_li=Categories Rule: in the function wp_list_categories then use this code:

    function remove_thematic_access() {
    remove_action('thematic_header','thematic_access',9);
    }
    add_action('init','remove_thematic_access');
    
    function my_category_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>
                <div class="menu">
                	<ul class="sf-menu">
                	<?php wp_list_categories('title_li=') ?>
                	</ul>
                </div><!-- .menu -->
            </div><!-- #access -->
    <?php }
    add_action('thematic_header','my_category_access',9);
    Posted 9 years ago #
  4. rkread
    Member

    I also am looking to replace the default horizontal 'page' menu with a "categories" menu that is consistent on all pages; it would be the main navigational device.

    --I would also like to add a Page menu above it, in the header area.

    --Additionally, I have a graphic page link I'd like to highlight in the header, separate from the page menu.

    To illustrate:
    a jpg of the page design:
    http://rkread.com/work/diyadd/DIY_ADD_LO_2col_tag_REV2.jpg

    the site so far:
    http://www.rkread.com/wp/

    I'm comfortable with CSS but know nothing about PHP and am having some difficulty understanding the above solutions, so your patience and beginner-oriented advice is greatly appreciated!

    -Robin

    Posted 9 years ago #
  5. rkread
    Member

    I was able to find the solution for the categories menu and the page menu up top--however, I'm still looking for a way to add an extra link to an "about page" that isn't part of a ul menu, located within the header. In this case, I want the text on the blue tag to be clickable. http://www.rkread.com/wp/

    TIA for all suggestions and advice.

    Robin

    Posted 9 years ago #
  6. johnxe22
    Member

    Hi,

    I tried this code and the first part works. However, if i add the second bit to remove the Categories Rule: then i get the white screen kiss of death from wordpress and everything is gone . . . no wordpress blog and certainly no wordpress admin.

    I am copying everything and pasting exactly but don't know what is going wrong. Any ideas?

    Thanks,
    john

    Posted 9 years ago #
  7. @rkread - take gene's code and add your link in somewhere. i am not sure which div you'd like it to appear in, but let's take for example that you'd like it to appear in a div before the #access div

    function remove_thematic_access() {
    remove_action('thematic_header','thematic_access',9);
    }
    add_action('init','remove_thematic_access');
    
    function my_category_access() { ?>
    
    <div id="about_link">
    <a href="#">About Link</a>
    </div>
        	<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>
    
                <div class="menu">
                	<ul class="sf-menu">
                	<?php wp_list_categories('title_li=') ?>
                	</ul>
                </div><!-- .menu -->
            </div><!-- #access -->
    <?php }
    add_action('thematic_header','my_category_access',9);

    or you could also add it to one of the empty hooks in the thematic_header 2,4,6,8 are all empty. see: http://bluemandala.com/thematic/thematic-structure.html to help you figure out which one you'd like to add it to:

    function about_link() { ?>
    <div id="about_link">
    <a href="#">About Link</a>
    </div>
    <?php }
    add_action('thematic_header','my_category_access',2);

    and where i've written 2, place the hook you've chosen from the diagram.

    @john - the 2 pieces of code are not meant to BOTH be placed in your functions.php. does that help?

    Posted 9 years ago #
  8. johnxe22
    Member

    Hi thanks!

    I finally realized that (one snippet or the other - not both) the other day after i had some good sleep - sometimes things get blurry late at night. Thanks everyone - SO much!

    Posted 9 years ago #
  9. Yes, If you use both of my snippets then you will get a fatal error because you have two functions with the same name. So only use one or the other.

    Posted 9 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.