1276 posts
  • Elite Author
  • Has been a member for 5-6 years
  • Sold between 100 000 and 250 000 dollars
  • Author had a Free File of the Month
  • Referred between 200 and 499 users
  • Bought between 10 and 49 items
  • Europe
  • Exclusive Author
+1 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?

812 posts
  • Author had a Free File of the Month
  • Exclusive Author
  • Sold between 10 000 and 50 000 dollars
  • Bought between 1 and 9 items
  • Referred between 1 and 9 users
  • Serbia
  • Has been a member for 5-6 years
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

374 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Has been a member for 3-4 years
  • United Kingdom
  • Referred between 100 and 199 users
  • Bought between 1 and 9 items
  • Exclusive Author
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