I am working with the anchor link to another page in a specific element id. I have these two optional codes but these two doesn’t work. when I see the link on the programmer view, the link is right and it works fine. but when I try to click from the menu navbar it doesn’t link and nothing happened. here are the two optional codes I have using so far:
<a href="<?php echo home_url( '/#aboutus' ); ?>">About Us</a>
and
<a href="<?php echo esc_url( home_url( '/' ) ); ?>#aboutus">About Us</a>
basically my goal is from top page anchor to another page in a specific element id. and from another page anchor it to top page in a specific element id. is there any ways how to achieve this anchor link?
3
Answers
You should do your code like this:
or
This should work.
If you are using this on home page then you should do like this:
OR
You want to do for inner page you should do like this: