Home Page menu as fixed menu
-
Hi, I got the Home Page menu solved (post https://www.ads-software.com/support/topic/menu-not-showing-up-in-home-page?replies=6)
but obiously, it only appears in the homepage. I want that menu to appear in subsequent pages (home page and page 2, 3, 4….) and other sections of the site. Is there a way to tell the Home Page menu to appear not only at the Home Page but also to the rest (or almost) of the site without having to create a custom menú for each element?
Thanks again.
-
BTW, this is the shortcode I’m using for the widget:
[cmwizard menu=2450 title="Menu" branch=current depth=2 depth_rel_current=1 ancestors=-1 ancestor_siblings=-1 include_level="1" exclude_level="1" siblings=1 container="nav" widget_class="widget_recent_entries"/]
I’d need to have the menu showing in the following pages of the Home Page (for the subctagery elements pages it works), and also for the single post, which I see doesn’t show either.
Sorry for double posting :/I’m not entirely certain, but I think what you’re asking for is the ability to have 2 different configurations within the same widget; one for pages that don’t correspond to a current item in your menu, and one for those that do?
If so, I’m afraid that that functionality is not currently available. It may be in the next upgrade, but there are no guarantees.
If that isn’t what you need then I’m a little confused…?
Something like that, yes. Mainly my problem is that the menu appears for the home page (as the current item then is the link for the home page) but if I click for the next pages of the home page it dissapears (homepage/1, homepage/2….). But for instance, going through a children element with several pages then it works and the menu appears in all pages.
Also, this is a diferent issue, I might have some wrong configuration, but I can go through all menu elements and children, but when I reach a post or page with no children in it, there is no menu.
You can check it at https://www.juansaman.es, menu appears at the right side in the homepage.
Thanks!
Done a bit of checking…
Scenario :
Front Page is set to display Your latest posts (in Settings, Reading) and the number of posts triggers pagination. Also, the custom menu has a Link menu item that points to the Home Page (let’s call it the Home-Page-Link).Now, when you land on the Home Page, WordPress sets a current property on the Home-Page-Link and gives it a class of “current-menu-item” (among other things).
However, when you then navigate to a paginated page – such as home/page/2/, home/page/3/, etc – WordPress still applies the “current-menu-item” class to Home-Page-Link, but does not set its current property!
Since CMW currently only uses the menu item’s current property to determine the “current item”, the paginated page gets missed as actually still being part of the “Home Page”!Technically, I not sure whether this is a bug in WordPress or in CMW, however I will put a work-around into CMW for the next release (specifically for this scenario). Meantime, I’m sorry that it doesn’t currently do what you need it to, but I’m afraid I don’t have a quick fix either.
For the other issue – when no children – you might want to check out the widget’s Fallback options?
Ok! I hope this helps to improve the plugin and make it even better ??
For the second issue, yes, I tried every fallback option (-1 (parent) and Current Item) but no luck. This happens for all posts or pages that belong to the menu elements. For instance: https://www.juansaman.es/49790/
Sorry, I misunderstood (again).
CMW only looks for menu items marked, by WordPress, as being the current menu item. When you go into a post – for which there is no specific related entry in your custom menu – then there is no menu item available to be marked as the current item. With no apparent current item, a CMW widget configured to depend on the presence of a current item will produce no output.
What WordPress does do is mark a Category menu item is being current_item_parent if a post is being displayed that belongs to that category. This effectively means that the menu has an item that is marked as the parent of the current item … without actually having a current item to be parent of (if you see what I mean).
I suppose it might be possible to cope with that scenario as well, maybe using it as a last resort if CMW can’t determine a “current item” by any other means. But I still have the restriction that CMW can only ever have one “current item”, yet a post can belong to more than one category, each of which could have a related item in the custom menu : CMW would only be able to use the first one encountered (as it currently does with all the other -prioritised – possibilities for “current item”).
However, even that solution (if it were available) may not suit you, because it would still require that a Category menu item exists for any category to which a post belongs, and I’m not sure that’s case with your current menu.Anyway, I will ponder upon it for the next release. But meantime, once again, CMW seems to fall short of your requirements, and I don’t have a quick fix. Sorry.
Afterthought : Actually there is one possibility, and that’s to hook into WordPress’s wp_nav_menu_objects filter and set whatever item you like as being “current”. [Filter is run immediately before calling walk_nav_menu_tree(), from within wp_nav_menu(); code in wp-includes/nav-menu-template.php]
You’d probably want to check for it being a CMW widget instance (the presence of$args->_custom_menu_wizard
), and possibly even for specific configurations of the widget (assign a unique class). You could zip through the items array searching for an item marked as “current”, falling back on setting the Home Page link as being current if you can’t find anything else? Of course this requires a bit of coding know-how, and preferably a child theme to place the code in …Ok, I see the problem, it looked simple at first but I see why is far than simple. No problem then, I’ll think in something, it’s good enough to have a thorough reply and understand it.
About the nav-menu-template edit you suggested, I took a look and I can see there is something key here to make some editing for my child theme, but that’s quite beyond my limited programing knowledge.
Anyway, thanks!v3.1.0 has just been released, which might resolve (some of?) your problems…
- Fixes the problem of paginated Home Page.
- Adds a “last resort” determination of current menu item : it’s in the Fallbacks section and has to be specifically enabled, but bear in mind the limitations discussed above, whereby there still has to be something in the menu that WordPress can designate as a parent.
- Now provides a (limited) dual-scenario capability, for occasions where one set of options is not quite sufficient.
Wow.
Just wow. It did the trick. Just setting the Fallback setting made it to work! Pagination works aswell ^^
You totally rock. THANK YOU!No problem. Sorry it took so long.
Just a thing I saw a few days ago and gave it some tries with no luck. Everything is working smoothly with the menu, but I can’t make it show when it comes to a post entry, which is odd because the menu worked fine. Maybe I clicked something without noticing, or maybe it was after the update (don’t think so) but I tried several configurations with no luck. I can’t make it appear at the post entry level :/
This is the shortcode I’m using:
[cmwizard menu=2450 title=”TITLE” branch=current depth=2 fallback=”current,+siblings” include_level=”2″ exclude_level=”1″ siblings=1 fallback_ci_parent=1 container=”nav” widget_class=”widget_recent_entries”/]Sorry to bring this back but wanted to be make sure in case there is a bug :S
Hi
As I tried to explain above, post entries are awkward unless they have their own entry in the menu.
If WordPress designates a menu item as the post’s current parent then CMW can use it (if no other specific current item is found), but if WordPress doesn’t (or can’t) somehow determine either a current item or a current parent then CMW is helpless.You could try running Appearance/Customise? Add a new CMW instance that simply shows the entire menu (the defaults of Level=1, unlimited Depth), then navigate to a post page. Inspect the listed items in the CMW full menu and see if any item has a class that indicates that it is either a current menu item or the parent of a current menu item. If nothing does, then that means that WordPress has been unable to set any sort of “current” indicator on a menu item when that particular post is being shown.
CMW’s new Alternative option is for just such a scenario.
Try setting up an Alternative, conditional upon no current item being found in the menu?Sorry to come to you so late, been on vacation.
I just had to work a bit more my options with the widget. Now it works 100% perfect ?? Thanks again!
- The topic ‘Home Page menu as fixed menu’ is closed to new replies.