[theme-reviewers] Theme preview on wordpress.org
Otto
otto at ottodestruct.com
Fri Nov 8 16:26:23 UTC 2013
On Fri, Nov 8, 2013 at 10:16 AM, Fruitfulcode <fruitfulcode at gmail.com>
wrote:
> Maybe it possible delete first version and upload latest to
http://wp-themes.com/fruitful/ ?
No, I'm not going to futz around with the previewer because of a problem
with your theme. If you want to me remove the theme from the listings
entirely, then I'm willing to do that, but the bottom line is that the
theme is broken and you need to fix it.
> On fresh wordpress install, current theme version 1.0.7 can be activated
correctly, without any problems.
Only because you're doing it wrong. Soon, when we lock down the previewer,
your theme will be entirely broken. This is because you're doing-it-wrong.
Over here in this file for example:
http://themes.svn.wordpress.org/fruitful/1.0.7/inc/theme-options/theme-options.php
You have this code:
add_action( 'admin_init', 'fruitful_theme_options_init' );
If you examine that function you have this code:
if( !get_option( 'fruitful_theme_options' ) ) {
add_option( 'fruitful_theme_options', fruitful_get_theme_options());
}
This is entirely the wrong way to do defaults. The previewer system will
eventually silently fail all "add_option" calls because the database will
be entirely read-only. What will happen to your theme then?
Your theme needs to be able to work properly without being capable of
writing *anything* to the database. That's what "defaults" mean. It's the
settings you use *by default*.
Fundamentally, you probably need to rework most of your settings handling,
but here's one possible quick fix for you:
function fruitful_get_responsive_style () {
$theme_options = fruitful_ret_options("fruitful_theme_options");
if (isset($theme_options['responsive']) && $theme_options['responsive']
== 'on' ) {
wp_enqueue_style('main-style', get_stylesheet_uri());
} else {
wp_enqueue_style('main-style', get_stylesheet_directory_uri()
.'/fixed-style.css');
}
}
add_action('wp_enqueue_scripts', 'fruitful_get_responsive_style', 20);
You can see that I'm checking for both the setting being available and
turned "on" to enqueue the style.css, and for *all other cases*, I enqueue
the fixed-style.css. This means that at least one will always be enqueued.
The "default" case is to enqueue the fixed-style.css.
-Otto
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20131108/d9436d7c/attachment.html>
More information about the theme-reviewers
mailing list