Removing the title links in post lists

⚠️ Code snippets might not be compatible with the latest version of your theme. Always use a child theme to customize your theme, and test your code on a staging website before migrating to production.

The Customizr theme displays by default your post titles as links pointing to the single post.

Here’s a simple way (using some javascript) to remove those links if you ever need to.

Paste the following code in your functions.php :

add_action('wp_head' , 'remove_post_list_title_links');
function remove_post_list_title_links() {
	?>
	<script id="remove-links-in-title" type="text/javascript">
		jQuery(document).ready(function($) {
			$('.entry-title').each(function() {
				var $title_link = $('a[rel="bookmark"]' , $(this)),
					$title_text = $title_link.text();
				$title_link.remove();
				$(this).prepend($title_text);
			});
		});
	</script>
	<?php
}

More about customizing the Customizr theme here.

More about using jQuery in WordPress.

Leave a comment

Your email address will not be published. Required fields are marked *

9 thoughts on “Removing the title links in post lists”