• Resolved frankmanl

    (@frankmanl)


    Active page is highlighted in main menu – in this case page recepten (recipes) – and breadcrumb is Home » Recepten.
    All my recipes are in fact posts, not pages.
    When I read a single recipe the breadcrumb is Home » Blog » Pompoentaart and there is no more highlighting in the main menu.

    What I want to achieve when reading a single post is:

        breadcrumb Home » Recepten » Pompoentaart
        menu item recepten highlighted

    For the first problem I could change my posts page to recepten, but then I have another problem with page afdelingen: when I read one of those posts breadcrumb should be Home » Afdelingen » Non-food (and menu item afdelingen should be highlighted).

    How can I do this?

    Frank

    • This topic was modified 4 years, 3 months ago by Jan Dembowski.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator bcworkz

    (@bcworkz)

    There is not an individual recipe in your menu, is there? How would a menu item be highlighted if the current post isn’t in the menu?

    Regarding breadcrumbs, that’s a theme feature, it’s not part of core WP, so I suggest asking in your theme’s (OceanWP) dedicated support forum. There may be a filter or something allowing you to customize breadcrumb content.
    https://ww.wp.xz.cn/support/theme/oceanwp/

    Thread Starter frankmanl

    (@frankmanl)

    Thank you for your reply.
    There indeed is no single recipe in my menu and I don’t want them there either. I was wondering if there still is a way to get the main menu item highlighted when displaying a single recipe. Sounds like there’s not (which I can understand).
    Thanks for your advice on the breadcrumbs.
    Frank

    Moderator bcworkz

    (@bcworkz)

    Oh, I see, I think. When on a single recipe page you want the recipe menu item still highlighted? It actually is possible through the “wp_nav_menu” filter. IMO I think it could be confusing to end users since that’s not the page they are really on. OTOH a good breadcrumb trail would help alleviate any confusion.

    Anyway, in the filter, get the current queried object. If it’s in the recipe category (or what ever distinguishes recipes from other posts), find the recipe li item in the passed HTML and insert “current” into its class list.

    Thread Starter frankmanl

    (@frankmanl)

    Thank you, I’ll have a look at this.
    Frank

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘highlighting menu item when reading single post’ is closed to new replies.