Hello everyone, I thought this would have been a commonly done thing, but I can't seem to find any information on how to do this. So on my single.php template, I have a link that goes to the next published post: <?php next_post_link('<p class="nextPostLink">%link</p>' ,'Next Post');?> Code (markup): Output: <a rel="next" href="http://localhost/wordpress/next-post-name.html">Next Post</a> HTML: At the end of the link I want to put a named anchor link at the end. So it would look like this: <a rel="next" href="http://localhost/wordpress/next-post-name.html#postBeginning">Next Post</a> HTML: Anyone know how I can do this?
Open link-template.php file from the directory wp-includes, find the function adjacent_post_link and change the line $string = '<a href="'.get_permalink($post).'" rel="'.$rel.'">'; PHP: to $string = '<a href="'.get_permalink($post).'#postBeginning" rel="'.$rel.'">'; PHP: But it will be affect all next and previous posts links.
Thanks for that s_ruben! I'm trying to think... is there a reason I wouldn't want the named anchors on all next or previous post links?