Welcome, guest!

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

Error Message if I Add 2 Filters to Functions.php

  1. I want to add external links to my page nav, and I also want to change the anchor text for "Home" to "Blog Home." Its Hybrid News.

    So I need to add 2 filters to functions.php, as per:

    http://themehybrid.com/themes/hybrid/navigation#custom-page

    I can add one filter, or the other filter, but not both. I am guessing I am not combining the two filters properly, or something. But my trial and error has only led to errors so far.

    The code (which gets error messages) looks like this:

    <?php
    
    add_filter('wp_page_menu', 'custom_page_nav');
    
    function custom_page_nav($menu) {
    	$menu = false;
    
    	$menu = '<div id="page-nav"><ul>';
        $menu .= '<li><a href="http://www.findportablesolarpower.com" title="Solar Power Main Site Home Page ">Site Home</a></li>';
    	$menu .= wp_list_pages('title_li=&depth=1&echo=0');
        $menu .= '<li><a href="http://www.findportablesolarpower.com/store/" title="Solar Power Store">Solar Power Store</a></li>';
    
    	$menu .= '</ul></div>';
    
    	return $menu;
    }
    
    add_filter('wp_page_menu_args', 'custom_page_nav');
    
    function custom_page_nav($args) {
    
    	$args = array(
    		'show_home' => __('Blog Home','hybrid'),
    		'menu_class' => 'page-nav',
    		'depth' => 1,
    	);
    
    	return $args;
    }
    
    /**
    * This is your child theme's functions.php file.
    * You should make edits and add additional code above this point.
    * Only change the functions below if you know what you're doing.
    */
    
    /********************************************************/

    Any suggestions?

  2. You're not supposed to add both.

    Add one or the other. If you need external links in your Menu, use the first, if you need a regular menu, use the second. Also, you'll need to add

    'echo' => true,

    to the second, if that is what you need to use.

  3. Oh. I just wanted to add external links to the menu but also rename the "Home" link as "Blog Home."Maybe I can look around more in the code to see if I can find that anchor text.

  4. Are you using the Front Page template? If you are, then simply rename your page to whatever you want it to be called.

  5. Yes, I will do that.

    I wasn't using the Front Page template on all the blogs I wanted to do this on, but I think I will just start using it, as it makes this a lot simpler!

    Thanks again :)

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 (53 posts)
  • Hybrid Theme (22,812 posts)
  • Bliss Theme (255 posts)
  • Options Theme (10,362 posts)
  • Visionary Theme (767 posts)
  • WordPress (192 posts)
  • WordPress Plugins (2,150 posts)
  • bbPress Themes (308 posts)
  • General Discussion (5,616 posts)
  • Critical Theme (2 posts)
  • Hybrid News Theme (160 posts)
  • Hybrid Original Theme (32 posts)
  • Leviathan Theme (16 posts)
  • Life Collage Theme (21 posts)
  • Old School Theme (3 posts)
  • Outline Theme (121 posts)
  • Skeleton Theme (46 posts)
  • Structure Theme (2,774 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 (86 posts)
  • Hybrid Hook Plugin (7 posts)
  • Hybrid Hook Widgets Plugin (0 posts)
  • Hybrid Tabs (6 posts)