You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I implement the theme on blocks.wp-a2z, blocks.wp-a2z.org and other subdomains I'll want the menu items to point to the current site. I want the correct site url = as provided by site_url().
Proposed solution
In the absence of a solution delivered by Gutenberg, intercept the server side rendering using the same method as documented in #18.
And while we're at it....
Apparently the logic already supports current-menu-item - see WordPress/gutenberg#25575
so let's see if we can ensure that the current-menu-item class is set.
Looking at the current code, we need to set $attributes['id'] to the value of get_the_ID()
when the current URL is the same as the link's URL.
The logic that uses get_the_ID() only works for singular content.
In wp_nav_menus(), WordPress uses a far more complicated function called _wp_menu_item_classes_by_context().
We can implement a much simpler function, currently called fizzie_fiddle_nav_atts().
In order to support setting the CSS class names for current menu item's ancestors I'll have to implement this logic for core/navigation rather than core/navigation-link.
I've been creating the theme in
s.b/wp56
so theurl
attribute in thenavigation-link
blocks is of the formhttps://s.b/wp56/permalink/
Here's the current footer menu.
When I implement the theme on blocks.wp-a2z, blocks.wp-a2z.org and other subdomains I'll want the menu items to point to the current site. I want the correct site url = as provided by
site_url()
.Proposed solution
In the absence of a solution delivered by Gutenberg, intercept the server side rendering using the same method as documented in #18.
eg
And while we're at it....
Apparently the logic already supports
current-menu-item
- seeWordPress/gutenberg#25575
so let's see if we can ensure that the
current-menu-item
class is set.Looking at the current code, we need to set
$attributes['id']
to the value ofget_the_ID()
when the current URL is the same as the link's URL.
The text was updated successfully, but these errors were encountered: