A hyperlink on the web is a reference to an object on the Internet. It can be an image, a static/dynamic page, a movie file or even another website domain. We use the HTML tag <a>, called the anchor element to generate links. If you don’t want to read the theory, you can skip to the example directly.
Adding a link to an HTML page is quite simple and the syntax for that is,
<a href="url">Link text</a>
Now, this code will cause the browser to go to the ‘url’ upon clicking the Link Text. The ‘href’ attribute is used to designate the target address of the link.
What Are Anchor Links
Anchor links are an extremely useful tool for easy navigation on extremely large posts and pages. These links, also called internal links or page jumps are used to navigate inside the page from one place to another. You might have seen links like ‘Go To Top’ or, footnotes which again allow jumping back to the last position. These are called Anchor Links. It’s very easy to create Anchor links in a page with a couple of lines of coding.
Creating Anchor Links
To create simple Anchor links in wordpress posts, first switch to the HTML editor mode. Inside that mode, suppose you want to create a link to go to a specific part of the page like the example anchor at the top, you can do so by adding this simple code.
Example Code
What we have done in this page is, I have set an anchor to this heading. The code reads as,
<h3 id="Example">Example Code</h3>
At the top of the post, you can see a link called example. When you click on that link, the page will jump to this heading. The hyperlink created at the top of the post has a code similar to this,
<a href="#Example">example</a>
So, whenever you click on the example link at the top, it will search for an element named Top in the page (as the link is relative). When it finds an object with the specified name, browser jumps to that location. Here, the current heading is named Example and the link at the top jumps to an object named Example so, when you click on that link, the browser jumps to this heading.
It’s pretty simple actually, in even more simple words, a named anchor is created like this,
<a name="anchor">Named Anchor</a>
And a link to that named anchor, within the same page is created like this,
<a href="#anchor">Jump to the Named Anchor</a>
If you want a link to jump to a specific location in a different page then you will have to provide the full path of the link. (along with the URL and the path). Return to the Top.



Beautiful !
Just what I was looking for.
Thank you!
Mike
Best article for Anchor link.I saw this article and i followed all mentioned steps.
Thanks for sharing this nice article.
Sam
Ive followed your steps and it still doesn’t seem to work, I can’t figure out where I am going wrong. Help?
Try and not switch between the standard and the HTML views. That can sometimes cause problems.
It works when I do it in notepad…thank you.
But when I insert the working code into wordpress and try it, the “target _blank” is added and it spawns a new page every time and it is driving me nuts. I pulled up the source code view of the review page, and sure enough it has been “adjusted”.
I used the html view, but no matter what I do, wordpress keeps tweaking the code after I save it.
Yes, this is a problem with WordPress. If you switch between the standard mode and the HTML mode then WordPress tends to forget the changes you made. We always have a hard time inserting code samples in posts because of this.
Is here a plugin to achieve this as i have zero HTLM skills, I just build our website using the CMS without using the HTLM?
Hi Allan,
Not exactly sure but here’s a couple of links to get you started.
http://wordpress.org/extend/plugins/auto-anchor-links/
http://wordpress.org/extend/plugins/anchor-links/
[...] mode. Inside that mode, suppose you want to create a link to go to a specific part of the page like the example anchor at the top, you can do so by adding this simple [...]
I’ve been trying to figure out how to link to a specific spot on another post, and your article was really helpful, thanks!