krafit / wp-gitlab-updater

♻️ WordPress plugin to get updates for themes and plugins from private GitLab repos — can also be implemented into a plugin or theme.
58 stars 24 forks source link

Error detected with theme check plugin #11

Closed jmfergeau closed 5 years ago

jmfergeau commented 5 years ago

Still working on my theme and, since it's apparently possible to post a fork of a theme, I decided to do the necessary to post mine there.

Among the errors the plugin "theme check" found, there's one about theme-updater.php from wp-gitlab-updater:

INFO: theme-updater.php The theme appears to use include or require. If these are being used to include separate sections of a template from independent files, then get_template_part() should be used instead.
Line 25: require_once 'updater-base.php';

Well I know wp-gitlab-updater is no longer necessary if you post the theme in wordpress repos. Though this error looks interesting and maybe it's good to know it. Maybe it's even related to my previous error #10 ?

florianbrinkmann commented 5 years ago

That is only a notice (note the INFO at the beginning, it is not an error :) ) that a theme should use the get_template_part() function to include things like the files for displaying the content of a post.

In the background this function calls locate_template() which calls load_template() which itself makes a require_once or require statement (depending on a parameter, in the case of get_template_part() it is a require.

get_template_part() makes it easy for child themes to overwrite the files of the parent theme, but that is nothing we want for the updater.