evertiro / historical-redux2

A simple, easily extendable options framework for WordPress based on NHP Theme Options Framework.
http://reduxframework.com
Other
105 stars 43 forks source link

Theme-Check plugin errors #61

Closed butucea closed 11 years ago

butucea commented 11 years ago

Hello, I've installed the framework on a theme and then ran the "theme check" plugin. It shows he following errors:

WARNING: file_get_contents was found in the file options.php possible file operations. Line 693: 'content' => nl2br( file_get_contents (trailingslashit(dirname(FILE)) . 'README.html'))

REQUIRED: defaults.php. Themes should use add_theme_page() for adding admin pages. Line 184: $this->page = add_submenu_page ( Line 206: add_submenu_page($this->args['page_slug'], $this->args['page_title'], '', $ Line 209, 219, 229 and 239: add_submenu_page(

INFO: options.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 17: require_once (dirname(FILE) . '/admin/defaults.php');

INFO: defaults.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 322: require_once ($this->dir . 'fields/' . $field['type'] . '/field_' . $field[' Line 523: require_once($this->dir . 'validation/' . $field['validate'] . '/validation Line 838: requireonce($this->dir . 'fields/' . $field['type'] . '/field' . $field['

INFO: admin.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 57: include_once (ABSPATH . WPINC . '/feed.php');

evertiro commented 11 years ago

The warning on line 693 is because of demo content. That line is there solely to show how you could include an external readme or similar into the framework. If you are not using it you are free to remove it (along with any other non-needed code in options.php).

The required flag can be ignored safely, add_theme_page() specifically adds to the Appearance menu. In our case, the options page can be added anywhere (as either a parent or child menu) so add_submenu_page() is the appropriate way to do it.

The other three are in reference to using get_template_part(). I explained why we don't use that in the updated README I posted yesterday. In summary, the codex page on get_template_part() recommends reading an article posted recently which specifically says not to use get_template_part() on admin panels, just on frontend pages.

If you have any further questions, please feel free to ask!