studiopress / genesis-sample

This is the sample theme created for the Genesis Framework.
https://demo.studiopress.com/genesis-sample/
529 stars 284 forks source link

Specify minimum Genesis version when supported by Genesis #172

Open ghost opened 5 years ago

ghost commented 5 years ago

after downloading and upon activating the Genesis Sample theme I get an error.

Fatal error: Uncaught Error: Call to undefined function genesis_get_config() in /Users/brodyr/Documents/sites/wordpress/wp-content/themes/genesis-sample-develop/functions.php:131 

Stack trace: 

#0 /Users/brodyr/Documents/sites/wordpress/wp-settings.php(441): include() 

#1 /Users/brodyr/Documents/sites/wordpress/wp-config.php(91): require_once('/Users/brodyr/D...') 

#2 /Users/brodyr/Documents/sites/wordpress/wp-load.php(37): require_once('/Users/brodyr/D...') 

#3 /Users/brodyr/Documents/sites/wordpress/wp-admin/admin.php(31): require_once('/Users/brodyr/D...') 

#4 /Users/brodyr/Documents/sites/wordpress/wp-admin/themes.php(10): require_once('/Users/brodyr/D...') 

#5 {main} thrown in /Users/brodyr/Documents/sites/wordpress/wp-content/themes/genesis-sample-develop/functions.php on line 131
marybaum commented 5 years ago

Yup! I've got it too.

`

( ! ) Fatal error: Uncaught Error: Call to undefined function genesis_get_config() in /Users/marybaum/Sites/dts 3.8.5/proshop.dev.cc/wp-content/themes/genesis-sample/functions.php on line 131

1 | 0.0051 | 538240 | {main}( ) | .../index.php:0 2 | 0.0052 | 540192 | require( '/Users/marybaum/Sites/dts 3.8.5/proshop.dev.cc/wp-blog-header.php' ) | .../index.php:17 3 | 0.0055 | 552792 | require_once( '/Users/marybaum/Sites/dts 3.8.5/proshop.dev.cc/wp-load.php' ) | .../wp-blog-header.php:13 4 | 0.0056 | 563776 | require_once( '/Users/marybaum/Sites/dts 3.8.5/proshop.dev.cc/wp-config.php' ) | .../wp-load.php:37 5 | 0.0064 | 648464 | require_once( '/Users/marybaum/Sites/dts 3.8.5/proshop.dev.cc/wp-settings.php' ) | .../wp-config.php:90 6 | 0.5636 | 48658192 | include( '/Users/marybaum/Sites/dts 3.8.5/proshop.dev.cc/wp-content/themes/genesis-sample/functions.php' ) | .../wp-settings.php:441

`

nathanrice commented 5 years ago

If you're not running the Genesis 2.8 Beta, you'll get this error.

Try installing the Genesis 2.8 Beta and let us know if that fixes you up.

marybaum commented 5 years ago

Will do!

marybaum commented 5 years ago

Worked a treat, of course! Had cruised over here figuring there had to be a version with the new function

ghost commented 5 years ago

when will you release 2.8?

nickcernis commented 5 years ago

@broros Genesis 2.8.0 is currently scheduled for 16 January 2019, although that may change. You can try it now using the Genesis Beta Tester plugin if you wish: https://wordpress.org/plugins/genesis-beta-tester/

Genesis Sample 2.8.0 will likely be released at the same time or shortly afterwards.

eclectic-coding commented 5 years ago

So this error reported and confirmed by @marybaum and @broros raises and interesting question. Will there be any error checking or backward compatibility added to genesis-sample? As it stands now, any user who installs the theme (v. 2.8) without updating Genesis first, will be confronted with the same error.

Overall, I love the idea of a move to configuration loading with genesis_get_config'. I find it interesting the files used so far in./configare :html,menus,accessibility, andcustom-logo. These files can be loaded as: i.e.add_theme_support( 'genesis-accessibility', genesis_get_config( 'accessibility' ) );`

However each of these files are still in the core and can be loaded as: i.e. add_theme_support( 'genesis-accessibility' );

Are all theme_supports begin moved to config? Or is config a place where a developer can expand the way themes are designed? I am concerned that without backward compatibility or error checks, it may become problematic.

nickcernis commented 5 years ago

Will there be any error checking or backward compatibility added to genesis-sample?

We've not done this in the past for other versions of Genesis Sample that required specific versions of Genesis, although I believe this is the first time users will see a fatal error if they're not running the latest Genesis so I agree it's worth considering.

Ideally it should be the role of WordPress core to determine minimum parent theme, WordPress, and PHP versions for plugins and themes. There was a proposal for a parent theme minimum version check on activation, but it was recently closed due to inactivity.

For now we could:

I'm not sure this is a massive improvement on throwing a fatal error (because the theme still won't work as expected), but at least it's more user friendly.

Are all theme_supports being moved to config? Or is config a place where a developer can expand the way themes are designed?

The Genesis configuration API in Genesis 2.8 lets child theme developers do two things:

  1. Override certain Genesis parent theme settings by placing a config file of the same name as the parent theme file in your child theme.
  2. Load PHP configuration data that was scattered throughout a child theme from a consistent central location (the child theme's config folder).

There will be full documentation on the whys and hows of this when Genesis 2.8 launches (or shortly after).

nickcernis commented 5 years ago

We've decided to abstain from adding minimum Genesis version checking logic in the child theme for now. Instead, we'll investigate ways to move that logic to Genesis itself and have child themes specify their minimum requirements in a more simple way.

Requirements API for specifying minimum Genesis version in child themes https://github.com/studiopress/genesis/issues/2123

I'm leaving this open so we can (a) track the impact of this in support and (b) add version checking requirements if/when Genesis implements an API for it.