1625 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 6 years
  • Has sold $500,000+ on Envato Market
+8 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?

815 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

407 posts
  • Became a Top 20 Author of the Month
  • Had an item that became a weekly top seller
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $250,000+ on Envato Market
+7 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