1343 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Made it to the Authors' Hall of Fame
  • Has been part of the Envato Community for over 5 years
  • Has sold $250,000+ on Envato Market
+6 more
fuelthemes says

Hi everyone,

Currently, I am using require_once/include to import different functions in functions.php using:

include( 'functions/heading.php' )

Theme check advises me to use “get_template_part()”. How can I achieve this?

814 posts
  • Has referred 1+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 1+ items on Envato Market
  • Contributed a free file of the month
+3 more
rvision_ says

Forget about that, Theme check cannot be that smart ;)

If those included files are php code only (functions/classes/etc.), they cannot be template part

388 posts
  • Has referred 100+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+5 more
EugeneO says

By using get_template_part() it allows users to edit that particular file by adding their own version in a child theme. If it is a file they are unlikely to need to edit then using include shouldn’t be a problem. If it’s something like a navigation bar or section of HTML they might want to edit then go with get_template_part().

by
by
by
by
by
by