Block editor: Apply styling settings to custom elements

Published: Leave a comment

Custom styling settings for custom elements could be so easy: use the block selector API to define the selector where the styles should apply and enable the applicable styles in the block.json. But unfortunately, it doesn’t work this way. If you need to apply styling to a custom element inside your block and not the surrounding element, you need to implement it manually. Luckily, Aki Hamano shared a how-to on GitHub.

Continue reading Block editor: Apply styling settings to custom elements

Remove current-menu-item class from anchor menu items

Published: Leave a comment

If you’re using links with anchors in your menus, you may notice that they sometimes automatically get the class current-menu-item, which may not what you want to. This is especially true if you have a sub-menu with anchors pointing to an ID on a sub page. This would result in all the anchor links being highlighted as active with the current-menu-item class when the sub page is accessed.

Continue reading Remove current-menu-item class from anchor menu items