My site is using a nav menu in my custom theme. I want to add navigation links to anchored links that points to specific sections of the site home page using a Custom Link
in the nav menu.
I want to use the equivalent of:
<?php echo get_home_url(); ?>/#xxxx
in the URL field. If I use just the anchored link #xxx
as the Custom Link
, it will work fine on the home page, but it will not link from another page (as that anchor section is not on that page).
There has to be a clean way to do this. When I insert the php code as well, it appears to work on the home page, but not from another page. I've gone through all the other related posts, but none seem to address this issue.