One of the great things about the Genesis Framework by Studiopress is that virtually everything can be changed.
Another great thing is that there are so many tutorials available on how to make those changes.
The Studiopress website provides the following code snippet to remove the entry-content from a website:
// Remove the post content remove_action( 'genesis_entry_content', 'genesis_do_post_content' );
It does what it is supposed to do and removes all the content.
If you look at the HTML markup, however, you will find the following:
All the content is gone but our code snippet did not remove the entry-content HTML markup.
Something similar happens when entry-header and entry-footer are removed but both have hooks available to deal with the markup.
It seems a bit strange given the number and variety of all the available hooks, but it looks like there is no hook available to remove entry-content markup.
Now, it´s not like that empty markup would cause any real trouble for your website, or your website performance (think loading speed).
It´s more that it´s inelegant, unnecessary and just annoying.
So what can we do about it?
We have to leave PHP with its hooks and remove_actions behind for a moment and turn to Javascript, more precisely jQuery.
Among other things, jQuery allows quick and easy manipulations of the HTML on a website.
With a really short, single line of code, we can remove the empty entry-content markup:
$( ".entry-content" ).remove();
Really???
Really.
The easiest way to utilize that line of code in your website is to add it to an existing .js file of your WordPress theme that is already using jQuery.
Leave a Reply