envato / envato-wordpress-toolkit-library

WordPress Toolkit Library for Envato Marketplace hosted items
71 stars 29 forks source link

Calling the files with get_template_part? #3

Closed crissoca closed 12 years ago

crissoca commented 12 years ago

Hi there, nice work here!

Question is there any reason to have the files inside the envato-wordpress-toolkit-library folder?

Also any special reason to use include_once?

How about using get_template_part

I think that it's a good practice to use WordPress native bundles.

Japh commented 12 years ago

Hi there! Thanks for the suggestions.

It is in the sub-directory for organisational purposes, and we use include_once() instead of get_template_part() because it's an inappropriate context for using get_template_part(). As per the Codex, get_template_part() is to load template parts into templates, which this isn't.

If you're asking mainly due to the Theme Check warning, this is just an informational warning that you check the context to see if get_template_part() would be more appropriate to use.

valendesigns commented 12 years ago

Thank you Japh for your concise answer, you are correct. Using get_template_part() to include a file, not part of a template, would not be proper use of the function.