When displaying posts in your WordPress theme, you usually have the same chunk of code in multiple places throughout your theme, and it usually never changes.
For example, you typically have the same code in index.php, archive.php, search.php etc. and even the single.php page contains very similar code.
That doesn’t make any sense at all. A better approach is to include that code in one file, and reference that file in index, archive, search, single etc.: Don’t Repeat Yourself (DRY).
Nice idea Dan, This is very useful I will try this on my latest theme.. Thank you for sharing and Good Luck on the competition.
Are there any cons performance wise?
- Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
- Open a support ticket if you would like specific help with your account, deposits or purchases.
- Item Support by authors is optional and may vary. Please see the Support tab on each item page.
Most of all, enjoy your time here. Thank you for being a valued Envato community member.