Anchor target links go to a specific place on a page (or in a post) and consist of a target and a link. There are several ways to target content. We generally use IDs here at Trail Websites. A link is a link is a link to borrow a phrase. What makes these kinds of links different is that they end with the pound sign followed by the target’s ID.
<section class="tws-anshors" id="target-1">Target text</section>
A link to that target:
<a href="#target-1">Go to Target</a>
If the link is on a different page than the target, it needs the page’s full URL before the #target-id part.
If you do these all the time, you get pretty good at typing them quickly in the text editor. If you do them less often, you end up looking up how to do them each time.
Trail Websites Anchor Target Creator gives you a simple tool to make it easy to create the targets. This plugin appears in the Visual Editor toolbar as a small orange button with an anchor inside. It is in early release and is ready for those that know how to manually install a plugin.
The text that should be used as the destination is entered or edited first. If you select text in the editor before clicking the Anchor Target Creator button, it will be pre-filled for you.
Next, enter an ID for the target. This should be unique on the page and consist of letters, numbers and dashes only, with no spaces. For example, quote-1 is a good ID.
Click “Create Anchor Target” to add the target to your page or post.
After creating a target, you can modify it in the Text View in the Editor.
In the Text View, targets appear like:
<section class=”tws-anchor” id=”target-id”>target text</section>
Targets are not very useful without a link or links that target them. You can create links to your targets manually or with the link button in the Editor Toolbar. If using the link button, you can type a pound sign and your target ID if the target is on the same page or in the same post such as #target-1 but if the target is on another page, you need the full URL of that page. You can search for it and select it from the link tool then add your target to the end before clicking “Done” so that your link destination looks something like this:
To create a link manually, use the Text View in the Editor following the above guidelines so that a same-page link looks similar to:
<a href=”#target-id”>Link Description</a>
or a link to a target on another page looks similar to:
<a href=”http://yourdomain/targetpage#target-id”>Link Description</a>
To install the Trail Websites Anchor Target Creator, download the zip file, decompress it, copy the tws-anchors folder and its contents to your plugins directory then Activate the plugin from the WordPress Admin Plugins page. If this confuses you, you may want to wait until we polish this up more and either upload it to WordPress.org or provide an installer.
The Trail Websites Anchor Target Creator is provided free of charge and supported on an as-available basis. You can use the contact form here on the website if you have questions about it.