When I am creating a Wordpress theme It's my job to comment the code which creates the element I wish to remove, but I'm wondering if professional Wordpress theme designers get it done by doing this. Does Wordpress have filters and declaration which remove elements?
For example getting rid of elements within the contact page (e.g Website area). Date and links (e.g published_in and published_on) in posts (single.php) etc...
I understand 3 ways to date:
- Via CSS: giving the element display: none
- Leaving comments (
<!-- -->, //) or removing the code
- With a couple php filters or terms
Which is easily the most efficient and simple way (the one which professional Wordpress designers use?)
It is dependent on in which the code has been produced from. Whether it's inside your theme files, then the easiest way would be to comment or remove the code. By doing this, no processing is needed to show the element after which hide it with CSS or take it off having a filter.
- By not modifying the core files, you do not run any chance of breaking your website should you upgrade WordPress.
- You retain how big your produced pages more compact and for that reason faster to load.
Using CSS to cover should simply be a last measure because the user still needs to download the hidden markup and anybody browsing without CSS or utilizing a screen readers will still encounter all individuals elements you wouldn't want in your site.