This WordPress plugin makes it easy to add an anchor location.
The ID should begin with a lower-case letter and be followed by any number of
lower-case letters (a-z), digits (0-9), hyphens (-), and underscores (_).
There should be no more than one hypen (-) in a row.
When the anchor is displayed, the WordPress function esc_attr() is applied to the ID.
You can add an anchor location manually by adding the shortcode
[anchor id="second-section"]
You can now link to this with a URL like http://example.com/page#second-section
or #second-section for anchors on the same page.
You can add the anchor shortcode with the TinyMCE button that looks like an anchor.
When you click this button, you'll be prompted for the ID you want to use.
You should follow the rules outlined above in Rules for Anchor IDs.
The ID rules will be enforced when the anchor is added with the WYSIWYG editor:
- By applying the WordPress function sanitize_title()
- If the
IDdoes not begin with a letter, theIDwill be prefixed withmy-
If you enter Spaces, -Dashes-, and other ch@racter$ are %REMOVED%!, the result is
[anchor id="spaces-dashes-and-other-chracter-are-removed"]
If you enter 5-dogs-in-a-row, the result is
[anchor id="my-5-dogs-in-a-row"]
The shortcode [anchor id="my-anchor-id"] will output
<span class="fe-anchor" id="my-anchor-id"></span>
The class .fe-anchor is included on all anchors output as a generic target
for future JavaScript or CSS.
Anchor Icon from Feather Icons