Is it possible to link to the same page from wordpress page menu?
I have a big one page wordpress site and a menu created from wordpress admin pages panel. I added everywhere in my main page such links like <A NAME="gohere">
and similar. Now I need to add href's to the page menu name's lik开发者_如何学Pythone <a href="#gohere">
Actually I do not know is it possible to do this from the wordpress admin page's menu or maybe anybody know where these pages are stored so that I could add the links manually in the file's. Thanks!
Tried plugin "Page Links to" and added something like <A NAME="gohere">
as a link in where, but unfortunately plugin do not understand this,
Regards,
You shouldn't use the name
attribute of the a element. Instead, assign ID
values to the elements of your page, for instance:
<a href="#foo">Link to foo</a>
<div id="foo">
<!-- Your foo content goes here -->
</div>
For your question: You can manually add links to your WordPress menu, entering custom values as the href
attribute. To add a link, enter #foo
in the URL field of the custom link in the menu admin section.
Are you using the WordPress's built in menu manager? (Appearance -> Menus)
If so, then yes it should be fairly simple.
First you need to mark the areas within the page you want to link to - setting an ID to the element is enough. So if you want the browser to scroll to the top of the latest posts when a link is clicked, for example, you need to add an ID to the tag that contains the latest posts. Then give it a unique name (this is important). So something like id="latest_posts_area" should do it. Be warned though, you may need to edit the template files to do this, so ensure you have taken a backup of your theme just in case you make any mistakes.
So, if you have:
<div class="latest_posts">
You would edit it to be:
<div class="latest_posts" id="latest_posts_area">
Then, in the admin menu, when adding/editing a link, you simply set the URl as #latest_posts_area - then on every page that link is visible, clicking it will scroll the users browser to the to the top of the tag you added the ID to.
精彩评论