-
Notifications
You must be signed in to change notification settings - Fork 12
Heading Anchor
Ben Gillbanks edited this page Jul 28, 2020
·
5 revisions
Adds links to headings throughout the page.
Each heading gets a unique anchor based upon the heading text.
Also adds a link, using a pound sign #, that links to the containing anchor.
Only links the first 4 heading sizes, h1
, h2
, h3
& h4
.
If you don't want a heading to have an anchor added then add the class toolbelt-skip-anchor
. Toolbelt will then skip that heading, however it will still add an id so that it can be linked. It just won't include the anchor link element.
Disable the heading anchors on certain pages:
function my_disable_heading_anchors() {
// Hide on the posts with the specified ids.
if ( in_array( get_the_ID(), array( 15, 18, 24 ) ) ) {
return false;
}
return false;
}
add_filter( 'toolbelt_heading_anchors_display', 'my_disable_heading_anchors' );
Toolbelt is built by Ben from Pro Theme Design.