Figuring out Page Jumps or Anchor Links For WordPress is one of those tasks that seem like it could be simple but if you don’t have the information it can be one of the pesky WordPress problems that’ll drive you nuts.
Why is it so Damn Hard to Find a Solution For Anchor Links For WordPress?
The problem starts when trying to Google “Anchor Links in WordPress” for the solution. WordPress calls them “Page Jumps. What the heck is a “Page Jump”? It’s like trying to learn how to change the oil in your car but your car maker names an oil change, “Slippery Liquid Replacement Procedure” This rebranding of “anchor links” makes it difficult to find the simple solution
Avoid The Rabbit Hole and Don’t Blame Your Browser
I’ve noticed that the first thing folks will blame for the problem is your browser. Ignore this rabbit hole. It’s not your browser. The problem is the code. There’s a lot of stuff going on underneath the hood with HTML and WordPress, and for some reason, you have to handle in page links a different way.
Hopefully, this post finds you. Anchor Links in WordPress is easy and it has nothing to do with your browser so ignore that rabbit hole.
Below Allows You to Place a Link to Content on the Same Page
STEP 1 – ADD LINK
This code will create the link that will take you to a place on the same page.
Or if the Link is In a Menu Item (Custom Link)
I suggest not doing this because you can not hit the back key which is a big NO NO because you are overriding an assumed function. Doing this upsets surfers.
STEP 2 – ADD JUMP LOCATION
Place this code where you want the user to go on the page when the click the link above.
NOTE: You enter this code in the “Text” view in the post or page editor in WordPress. Stay out
NOTE NOTE: Is WordPress removing empty <div> containers? Add this function to your functions.php
/ START Stop removing div tags from WordPress - Linklay
function ikreativ_tinymce_fix( $init )
{
// html elements being stripped
$init['extended_valid_elements'] = 'div[*]';
// pass back to wordpress
return $init;
}
add_filter('tiny_mce_before_init', 'ikreativ_tiny_mce_fix');
// END Stop removing div tags from WordPress - Linklay