Site logo

Archived topic

Labeling the mobile menu based on category base?

9 replies · Started by Paul on September 27, 2017

Viewing posts 1–10 of 10

Hi, is it possible somehow to name my mobile menu label differently based on which category the user is in?

If yes, what would be the best way to do this?

You could do something like this:

add_filter( 'generate_mobile_menu_label', 'tu_category_mobile_toggle_text' );
function tu_category_mobile_toggle_text( $label ) {
    if ( is_category( 'Sample Category' ) ) {
        return 'Sample toggle';
    }

    if ( is_category( 'Another Category' ) ) {
        return 'Another toggle';
    }

    return $label;
}

That's great. Thanks Tom.

You're welcome :)

Hi Tom,
How to add it on page header setting since my header has the logic of classification? Also how to enlarge the font?

Hi there,

I don't think your question is related to mobile label so please open a new topic.

Thanks!

Hi Leo,
It is related to mobile menu label. Let me clarify. So what I'm trying to achieve is to have 2 different mobile label for different pages. Tom suggested to use conditional tag, but is it possible to put the coding on page header setting? Since mobile menu is part of the header (on mobile header). Also I don't need to use conditional tag because I will assign the header setting by page.

Hi there,

I'm afraid that wouldn't be possible currently using the Page Header module.

Hi Tom,
Thanks for the info. How to enlarge mobile menu label? Thank you.

We can use CSS for that. Can you open a new topic? thanks!

This archived topic is closed to new replies.