ThemeForest

"Don't Repeat Yourself" in WordPress Templates

352 posts
  • Has been a member for 3-4 years
  • Author had a File in an Envato Bundle
  • Author had a Free File of the Month
  • Exclusive Author
  • Sold between 10 000 and 50 000 dollars
  • Bought between 10 and 49 items
  • United Kingdom
  • Referred between 50 and 99 users
danharper says

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).

I show how to do this in this screencast for the new Nettuts Screencast Competition

:)

3 years ago
979 posts
  • Has been a member for 3-4 years
  • Interviewed on the Envato Notes blog
  • Exclusive Author
  • Sold between 10 000 and 50 000 dollars
  • Bought between 10 and 49 items
  • Philippines
  • Referred between 100 and 199 users
mabuc says

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. :)

3 years ago
1011 posts
  • Has been a member for 3-4 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Author had a Free File of the Month
  • Exclusive Author
  • Sold between 100 000 and 250 000 dollars
  • Elite Author
  • Bought between 10 and 49 items
  • Europe
  • Referred between 100 and 199 users
turkhitbox says

Are there any cons performance wise?

3 years ago
352 posts
  • Has been a member for 3-4 years
  • Author had a File in an Envato Bundle
  • Author had a Free File of the Month
  • Exclusive Author
  • Sold between 10 000 and 50 000 dollars
  • Bought between 10 and 49 items
  • United Kingdom
  • Referred between 50 and 99 users
danharper says
Are there any cons performance wise?

Nope :)

3 years ago
by
by
by
by
by