ThemeShaper Forums » ThemeShaper WordPress Themes

"Home" in drop-down menu not translatable

(10 posts)
  • Started 10 years ago by BioGasa.nu
  • Latest reply from BioGasa.nu
  • This topic is not resolved
  1. I'm using WP 2.8.6 (language set to Swedish) and Thematic 0.9.5.1 and ThematicPowerBlog and WP's feature of using a static page as home page. This page is named "Hem" (Swedish) but the first item on the drop-down menu still says "Home."

    Is this something that should be added to a .po/.mo file, or am I looking in the wrong place?

    Posted 10 years ago #
  2. Hi-

    That text is controlled by an argument set for wp_page_menu. Changing the show_home arg to 'Hem' is what you need to do.

    function childtheme_menu_args($args) {
        $args = array(
            'show_home' => 'Hem',
            'sort_column' => 'menu_order',
            'menu_class' => 'menu',
            'echo' => true
        );
    	return $args;
    }
    add_filter('wp_page_menu_args','childtheme_menu_args');

    -Gene

    Posted 10 years ago #
  3. Great, thanks for the quick help!

    For others wanting to do the same thing; that code is found in:
    wp-content/themes/thematicpowerblog/functions.php

    Posted 10 years ago #
  4. I continued by trying to hide the "Home" (or "Hem" in my case) link when you're on the actual home page, but it doesn't work. (I found the tag at http://codex.wordpress.org/Template_Tags/wp_page_menu )

    function childtheme_menu_args($args) {
    		if (!is_front_page() ) {
    		    $args = array(
    		        'show_home' => 'Hem',
    		        'sort_column' => 'menu_order',
    		        'menu_class' => 'menu',
    		        'echo' => true
    		    );
    		} else {
        		    $args = array(
    		        'show_home' => 0,
    		        'sort_column' => 'menu_order',
    		        'menu_class' => 'menu',
    		        'echo' => true
    		    );
    		}
        return $args;
    }

    What am I missing?

    Posted 10 years ago #
  5. You didnt include the add_filter I'd also suggest including a condition for is_home Like:

    function childtheme_menu_args($args) {
    		if (!is_front_page() || !is_home() ) {
    		    $args = array(
    		        'show_home' => 'Hem',
    		        'sort_column' => 'menu_order',
    		        'menu_class' => 'menu',
    		        'echo' => true
    		    );
    		} else {
        		    $args = array(
    		        'show_home' => 0,
    		        'sort_column' => 'menu_order',
    		        'menu_class' => 'menu',
    		        'echo' => true
    		    );
    		}
        return $args;
    }
    add_filter('wp_page_menu_args','childtheme_menu_args');
    Posted 10 years ago #
  6. The "Hem" thing works great (I had the add_filter, I just didn't paste it in to the forum post.)

    What isn't working is the hiding of "Hem" on the actual home page. I can see that the conditional if...else is working by setting

    'echo' => false

    in the else statement, which then hides the entire menu when I'm on the home page.

    Posted 10 years ago #
  7. is_front_page is not the same as is_home

    You need to set the condition for both or just for is_home

    Try :!is_front_page() || !is_home() Like in my example above.

    Posted 10 years ago #
  8. Yeah, sorry for not being clear; of course I tried your suggestion but it didn't work. I can see that the condition is working by setting:

    'echo' => false

    ...in the else statement, which hides the entire menu when I'm on the home page, but not on the other pages. However, setting:

    'show_home' => 0,

    ...still shows "Hem" on the home page. I also tried to switch the if...else statement around:

    is_front_page() || is_home()

    ...but that first item still shows up on the home page.

    I then tried to rename it:

    'show_home' => "Back Home",

    ...which instantly showed up on all other pages, but the home page still showed "Hem" indicating some sort of caching. Clearing all cookies didn't help either.

    Posted 10 years ago #
  9. The function I posted works as intended in my test environment. It sounds like you may have one too many filters on wp_page_menu Check your functions.php for multiple occurrences of wp_page_menu_args

    Posted 10 years ago #
  10. Thanks for all the help!

    I've searched the entire file structure for multiples, but to no avail. I also reverted to the default functions.php for both Thematic and Thematic Power Blog, copied your code and replace it in TPB's functions.php, and it still won't hide on the home page.

    Well, it's time to leave that annoyance and move on to other thing I need to fix before launching...

    Posted 10 years ago #

RSS feed for this topic

Reply

You must log in to post.