Welcome, guest!

Feel free to read the blog, browse for themes, or join the club.

Customizing Category Navigation

  1. I'm trying to customize my hybrid category navigation by adding some external links. I've inserted the following code into the functions.php file with no change to my site. I thought I'd used this code before and it worked. Not sure what's going on now.

    add_filter( 'hybrid_category_menu', 'custom_cat_nav' );
    
    function custom_cat_nav( $menu ) {
    	$menu = false;
    	$menu = '<ul id="cat-nav" class="menu sf-menu">';
    	$menu .= '<li><a href="http://somelink.com">Some link</a></li>';
    	$menu .= wp_list_categories( array( 'depth' => 4, 'exclude' => '1',  'title_li' => false, 'echo' => 0 ) );
    	$menu .= '</ul>';
    	return $menu;
    }
  2. You must be a logged-in exclusive member to view this reply.

  3. You must be a logged-in exclusive member to view this reply.

  4. That is fantastic Justin :)

    Is there a way to display say just 1 page and it's sub pages?
    Just want the home link first, then the categories, then the 'About Us' page/sub pages.

    echo '<div id="cat-nav" class="cat-nav"><ul class="menu sf-menu">';
    echo '<li><a href="http://www.example.com">Home</a></li>';
    
    echo str_replace( array( "\t", "\n", "\r" ), '', wp_list_categories( $args ) );
    wp_list_pages( array( 'title_li' => false ) ); // just display Category ID 2 menu items (About Us)
    
    echo '</ul></div>';

    Thanks for your time, kind regards, Ian

  5. You must be a logged-in exclusive member to view this reply.

  6. Thank you very much, that will work.

    It means they can't break the menu as I will add the pages as needed.

  7. Is it possible to specify child categories to the external "Some Link" you added above so they drop down?

  8. You must be a logged-in exclusive member to view this reply.

  9. No, I added the external "Some Link" to the cat-nav that you explained above. Now I would like to add more external links, however, I'd like them to drop down below "Some Link."

  10. You must be a logged-in exclusive member to view this reply.

  11. For modded cat nav on Hybrid News...so if I'm taking out the categories altogether and have one album external link and some pages it would look like this?

    echo '<div id="cat-nav" class="cat-nav"><ul class="menu sf-menu">';
    echo '<li><a href="http://www.example.com">album</a></li>';
    wp_list_pages( array( 'include' => '1,2,3,4', 'title_li' => false ) );
    
    echo '</ul></div>';
  12. Great! Thank you.

  13. Hmmm, got this error twice:

    Parse error: syntax error, unexpected '>' in /home5/unclutt4/public_html/testsitea/wp-content/themes/hybrid-news2/functions.php on line 105

    Here's my code:

    /**
     * Displays the category menu.
     *
     * @since 0.2
     */
    function news_cat_nav() {
    
    	$args = array(
    		'style' => 'list',
    		'hide_empty' => true,
    		'use_desc_for_title' => false,
    		'depth' => 4,
    		'hierarchical' => true,
    		'echo' => false,	// Leave as is.
    		'title_li' => false,	// Leave as is.
    	);
    
    	echo "\n\t<div id='cat-navigation'>\n\t\t";
    
    echo '<div id="cat-nav" class="cat-nav"><ul class="menu sf-menu">';
    
    echo str_replace( array( "\t", "\n", "\r" ), '', wp_list_categories( $args ) );
    echo '<li><a href="http://withpurpose.com">WithPurpose1</a>
    echo '<ul>';
    	echo '<li><a href="http://withpurpose.com">WithPurpose2</a></li>';
    	echo '<li><a href="http://withpurpose.com">WithPurpose3</a></li>';
    echo '</ul>';</li>';
    
    echo '</ul></div>';
    
    	echo '<div id="feed"><ul>';
    	echo '<li class="feed-url"><a href="' . get_bloginfo( 'rss2_url' ) . '" title="' . __('Subscribe to the feed', 'news') . '">' . __('Subscribe', 'news') . '</a></li>';
    	echo '</ul></div>';
    
    	echo "\n\t</div>\n";
    }
  14. You must be a logged-in exclusive member to view this reply.

  15. Ah! Figured it was a simple mistake. Thank you.

Reply

You must log in to post.

Limited Access

If you have an account, please take a moment to log in.

Non-exclusive members have limited access to the support forums.

To enjoy the full range of support, sign up for an exclusive membership in the theme club.

Support Forums

  • Core Framework (54 posts)
  • Hybrid Theme (22,711 posts)
  • Bliss Theme (255 posts)
  • Options Theme (10,362 posts)
  • Visionary Theme (767 posts)
  • WordPress (144 posts)
  • WordPress Plugins (2,146 posts)
  • bbPress Themes (308 posts)
  • General Discussion (5,572 posts)
  • Critical Theme (0 posts)
  • Hybrid News Theme (132 posts)
  • Hybrid Original Theme (26 posts)
  • Leviathan Theme (16 posts)
  • Life Collage Theme (9 posts)
  • Old School Theme (3 posts)
  • Outline Theme (108 posts)
  • Skeleton Theme (40 posts)
  • Structure Theme (2,768 posts)
  • Members Plugin (2 posts)
  • Cleaner Gallery Plugin (14 posts)
  • Get the Image Plugin (3 posts)
  • Message Board Plugin (0 posts)
  • Widgets Reloaded Plugin (0 posts)
  • Breadcrumb Trail Plugin (0 posts)
  • Query Posts Plugin (80 posts)
  • Hybrid Hook Plugin (7 posts)
  • Hybrid Hook Widgets Plugin (0 posts)
  • Hybrid Tabs (5 posts)