Note: This snippet is not needed anymore, just go through Appearance -> Customize -> Main content -> Post/Page Navigation and set up the navigation block visibility to suit your needs 😉
Hi,
In case you need to get rid of the post navigation block of links at the bottom of a single post, here’s a quick line of code to do it.
Where to copy/paste this code? => in your functions.php file. The best way to customize a theme in WordPress is to create a child theme. Everything you need to know about child theme creation in Customizr here
add_action ( 'wp_head', 'remove_single_post_nav_links'); function remove_single_post_nav_links() { //we only want to remove those nav links for a sinlge post and not for the list of posts if ( !is_single() ) return; //this action is defined in the class-content-post_navigation.php file remove_action ( '__after_loop' , array( TC_post_navigation::$instance , 'tc_post_nav' ), 20 ); }
That’it!
I hope this will help and look forward to reading your thoughts and your code if you find other ways to do that.
6 thoughts on “Removing the post navigation block of links”
Hi,
Change it to this. Please note the small change from TC_ to CZR_ in the penultimate line.
This code breaks the theme (returned Internal Server Error) in Version: 3.4.33, works fine before upgrade. Any solutions?
You may need to update the function name to correspond with your theme’s post navigation name space.
Hi, I would like to remove the navigation bar from only one category. How can I do this?
Hello Nicolas
Thanks for the great work on customizr. I have a question on this. I added the above code snippet to the custom CSS
block. But no change in the post navigation at the bottom of the post. Should I make the change somewhere else ?
Thanks mike
Hi Mike, and thanks! This code has to be copied in your functions.php