From 434b91b18aff554896d1002da5bcd1fc0568ce07 Mon Sep 17 00:00:00 2001 From: Christoph Herr Date: Mon, 2 Apr 2018 21:34:41 -0400 Subject: [PATCH] Sync with SVN version 1.2.0 --- README.md | 74 +++-- genesis-connect-for-woothemes-sensei.php | 135 +++------ index.php | 12 + .../genesis-connect-for-woothemes-sensei.pot | 21 +- readme.txt | 261 ++++++++++-------- src/index.php | 12 + src/sensei-integration/index.php | 12 + src/sensei-integration/sensei-integration.php | 62 +++++ src/site-layout/index.php | 12 + src/site-layout/site-layout.php | 41 +++ 10 files changed, 392 insertions(+), 250 deletions(-) create mode 100644 src/index.php create mode 100644 src/sensei-integration/index.php create mode 100644 src/sensei-integration/sensei-integration.php create mode 100644 src/site-layout/index.php create mode 100644 src/site-layout/site-layout.php diff --git a/README.md b/README.md index b9782c6..6790b31 100644 --- a/README.md +++ b/README.md @@ -1,42 +1,47 @@ # Genesis Connect for Woothemes Sensei -Contributors: christophherr -Donate link: https://www.christophherr.com/donate/ -Tags: woothemes sensei, woothemes, genesis, genesis connect, studiopress -Requires at least: 4.1 -Tested up to: 4.8 -Stable tag: 1.1.1 -License: GPL-2.0+ +Contributors: christophherr +Donate link: https://www.christophherr.com/donate/ +Tags: automattic sensei, sensei, genesis, genesis connect, studiopress, woocommerce sensei +Requires at least: 4.1 +Tested up to: 4.9 +Stable tag: 1.2.0 +License: GPL-2.0+ License URI: http://www.gnu.org/licenses/gpl-2.0.txt -This plugin integrates the Genesis Framework from Studiopress with the Woothemes Sensei plugin. +This plugin integrates the Genesis Framework from Studiopress with the Sensei plugin. ## Description -The base for this plugin is code taken from [WooThemes Support](https://support.woothemes.com/hc/en-us/articles/204428855-StudioPress-Genesis). +The plugin expands on the [Sensei Documentation](https://docs.woocommerce.com/document/sensei-and-theme-compatibility/) about adding theme compatibility. -You will need the [WooThemes Sensei](https://woocommerce.com/products/sensei/) plugin and the [Genesis Framework from Studiopress](https://www.studiopress.com) and/or one of its child themes. +You will need the [Sensei](https://woocommerce.com/products/sensei/) plugin and the [Genesis Framework from Studiopress](https://www.studiopress.com) and/or one of its child themes. -In other words, if you are not trying to integrate the Woothemes Sensei plugin with the Genesis Framework and/or one of its child themes, this plugin is pretty much useless for you... +In other words, if you are not trying to integrate the Sensei plugin with the Genesis Framework and/or one of its child themes, you don't need or want this plugin. -This plugin will only work (i.e. activate) if the Genesis Framework and its child themes and Woothemes Sensei are activated. +This plugin will only work (i.e. activate) if the Genesis Framework and its child themes are activated. Version 1.1.0 forces a content-sidebar layout on course, lesson and question posts to avoid the sidebar showing underneath the main content. -To change this new feature, you have to use a remove_action on the code the plugin is adding. -Add remove_action( 'genesis_meta', 'gcfws_force_content_sidebar_layout' ); to your functions.php. -If you want to use a different layout, the [Studiopress Snippets](https://my.studiopress.com/snippets/admin-management/) should help to get you started. +Version 1.2.0 adds the Genesis Layout options to course, lesson and question posts and archives and the module taxonomy allowing better control about the layout options. +For backwards compatibility, the single posts are still set to a content-sidebar layout but this can be overwritten by the Genesis Layout options. + +It should not be necessary to remove the formerly forced content-sidebar layout on single posts with + +remove_action( 'genesis_meta', 'gcfws_force_content_sidebar_layout_on_cpt_posts' ); + +in your functions.php anymore. Please use the Genesis Layout options instead. ## Installation -1. Upload the entire `Genesis-Connect-for-Woothemes-Sensei` folder to your `/wp-content/plugins` directory. -2. Activate the plugin through the 'Plugins' menu in WordPress. +1. Upload the entire `Genesis-Connect-for-Woothemes-Sensei` folder to your `/wp-content/plugins` directory. +2. Activate the plugin through the 'Plugins' menu in WordPress. Alternatively, you can -1. Click on 'Add new' in the 'Plugins' menu -2. Type (or copy and paste) the name of this plugin into the search box -3. Click on 'Install Now' +1. Click on 'Add new' in the 'Plugins' menu +2. Type (or copy and paste) the name of this plugin into the search box +3. Click on 'Install Now' ## Frequently Asked Questions @@ -50,12 +55,15 @@ Yes and no. Technically, it does. However, depending on other factors such as the individual theme's styling and layout, the output may be unexpected, and require some tweaking. Case in point, if the full-width layout is selected in the Genesis settings, lessons, course and question posts are showing a sidebar underneath the main content. -That´s why a content-sidebar layout is forced on single course, lesson and questions posts since version 1.1.0. -To remove this behaviour, add remove_action( 'genesis_meta', 'gcfws_force_content_sidebar_layout' ); to your functions.php. + +Version 1.1.0 forced a content-sidebar layout on single course, lesson and questions. +Since Version 1.2.0 the Genesis Layout options can be used to alter the appearance. ### Are there any settings? -No. You simply activate the plugin and the necessary wrappers are inserted into your Genesis child theme. +You simply activate the plugin and the necessary wrappers are inserted into your Genesis child theme. + +Since version 1.2.0, you can choose the layouts of your courses, lessons, questions and modules with the Genesis Layout options. ### How can I change how the plugin works? @@ -63,6 +71,13 @@ There are no settings and no settings screen. You would have to change the code ## Changelog +### 1.2.0 + +* Adds Genesis Layout options to course, lesson, and question posts and archives and the module taxonomy. +* Previously forced content-sidebar layout can be overwritten by the Genesis Layout options. +* Updates Readme. +* More modular code structure. + ### 1.1.1 * Better Code Standards. @@ -81,7 +96,7 @@ There are no settings and no settings screen. You would have to change the code ### 1.0.3 * Corrected oversight in the original code. First closing tag should be `` instead of `` -see: [Cobalt Apps Forum] (http://cobaltapps.com/forum/forum/main-category/main-forum/81542-woo-sensei?p=82210#post82210) + see: [Cobalt Apps Forum](http://cobaltapps.com/forum/forum/main-category/main-forum/81542-woo-sensei?p=82210#post82210) ### 1.0.2 @@ -97,15 +112,20 @@ see: [Cobalt Apps Forum] (http://cobaltapps.com/forum/forum/main-category/main-f ## Upgrade Notice +### 1.2.0 + +This version forces a content-sidebar layout on course, lesson and question archives and the module taxonomy. +Please refer to the readme.txt if you want to remove this feature. + ### 1.1.1 This version removes unnecessary code, follows WordPress Coding Standards better and updates links in the readme. ### 1.1.0 -This version adds a version check for Woothemes Sensei to use the appropriate array when removing the standard Sensei wrappers. -Version 1.1.0 also forces a content-sidebar layout on single course, lesston and question posts to avoid the sidebar showing underneath the main content. -Please refer to the readme.txt if you want to remove this feature. +This version adds a version check for Woothemes Sensei to use the appropriate array when removing the standard Sensei wrappers. +Version 1.1.0 also forces a content-sidebar layout on single course, lesson and question posts to avoid the sidebar showing underneath the main content. +Please refer to the readme.txt if you want to remove this feature. Woothemes Sensei has to be already active before the plugin will activate. ### 1.0.3 diff --git a/genesis-connect-for-woothemes-sensei.php b/genesis-connect-for-woothemes-sensei.php index 02cbb1f..7dad241 100644 --- a/genesis-connect-for-woothemes-sensei.php +++ b/genesis-connect-for-woothemes-sensei.php @@ -1,19 +1,19 @@ Geneis Framework is active. The plugin has been deactivated.', 'gcfws' ), 'http://www.studiopress.com' ); + $error = sprintf( + // translators: Link to the Studiopress website. + __( 'Sorry, you can\'t use the Genesis Connect for Woothemes Sensei Plugin unless the Genesis Framework is active. The plugin has been deactivated.', 'gcfws' ), + 'http://www.studiopress.com' + ); - echo '

' . $error . '

'; + printf( '

%s

', $error ); if ( isset( $_GET['activate'] ) ) { unset( $_GET['activate'] ); @@ -84,84 +104,15 @@ function gcfws_admin_notice_message() { } /** - * Load plugin textdomain. - * - * @since 1.0.1 - */ -function gcfws_load_textdomain() { - load_plugin_textdomain( 'genesis-connect-for-woothemes-sensei', false, plugin_basename( dirname( __FILE__ ) ) . '/languages' ); -} - -add_action( 'plugins_loaded', 'gcfws_load_textdomain' ); - -// Sensei Integration. -/** - * Declare theme support for Sensei - * - * @since 1.0 - */ -function gcfws_sensei_support() { - add_theme_support( 'sensei' ); -} - -add_action( 'after_setup_theme', 'gcfws_sensei_support' ); - -/** - * Force content-sidebar layout on Woothemes Sensei Course, Lesson and Question pages. - * - * @since 1.1 - */ -function gcfws_force_content_sidebar_layout() { - if ( is_singular( array( 'course', 'lesson', 'question' ) ) ) { - add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_content_sidebar' ); - } -} - -add_action( 'genesis_meta', 'gcfws_force_content_sidebar_layout' ); - -/** - * Remove the default Woothemes Sensei wrappers. - * Checks which version of Woothemes Sensei is running - * and removes the wrappers accordingly. + * Load the plugin files. * - * @since 1.1 - */ -function gcfws_remove_default_sensei_wrappers() { - - if ( Sensei()->version >= '1.9.0' ) { - remove_action( 'sensei_before_main_content', array( Sensei()->frontend, 'sensei_output_content_wrapper' ), 10 ); - remove_action( 'sensei_after_main_content', array( Sensei()->frontend, 'sensei_output_content_wrapper_end' ), 10 ); - return; - } - global $woothemes_sensei; - remove_action( 'sensei_before_main_content', array( $woothemes_sensei->frontend, 'sensei_output_content_wrapper' ), 10 ); - remove_action( 'sensei_after_main_content', array( $woothemes_sensei->frontend, 'sensei_output_content_wrapper_end' ), 10 ); -} - -add_action( 'genesis_meta', 'gcfws_remove_default_sensei_wrappers' ); - - -// Add custom Sensei content wrappers for Genesis. -/** - * Opening the custom Sensei wrapper - * - * @since 1.0 - */ -function gcfws_genesis_sensei_wrapper_start() { - echo '
'; -} - -add_action( 'sensei_before_main_content', 'gcfws_genesis_sensei_wrapper_start', 10 ); - -/** - * Closing the custom Sensei wrapper + * @since 1.2.0 * - * @since 1.0 + * @return void */ -function gcfws_genesis_sensei_wrapper_end() { - echo'
'; - get_sidebar(); - echo'
'; +function gcfws_autoloader() { + require 'src/sensei-integration/sensei-integration.php'; + require 'src/site-layout/site-layout.php'; } -add_action( 'sensei_after_main_content', 'gcfws_genesis_sensei_wrapper_end', 10 ); +gcfws_autoloader(); diff --git a/index.php b/index.php index e69de29..7e33169 100644 --- a/index.php +++ b/index.php @@ -0,0 +1,12 @@ +\n" "Language-Team: LANGUAGE \n" @@ -17,10 +17,11 @@ msgstr "" msgid "Sorry, you are not allowed to access this page directly." msgstr "" -#: genesis-connect-for-woothemes-sensei.php:77 +#. translators: Link to the Studiopress website. +#: genesis-connect-for-woothemes-sensei.php:95 msgid "" "Sorry, you can't use the Genesis Connect for Woothemes Sensei Plugin unless " -"the Geneis Framework is active. The plugin has been " +"the Genesis Framework is active. The plugin has been " "deactivated." msgstr "" @@ -28,16 +29,16 @@ msgstr "" msgid "Genesis Connect for Woothemes Sensei" msgstr "" -#. #-#-#-#-# plugin.pot (Genesis Connect for Woothemes Sensei 1.0.1) #-#-#-#-# +#. #-#-#-#-# genesis-connect-for-woothemes-sensei.pot (Genesis Connect for Woothemes Sensei 1.2.0) #-#-#-#-# #. Plugin URI of the plugin/theme -#. #-#-#-#-# plugin.pot (Genesis Connect for Woothemes Sensei 1.0.1) #-#-#-#-# +#. #-#-#-#-# genesis-connect-for-woothemes-sensei.pot (Genesis Connect for Woothemes Sensei 1.2.0) #-#-#-#-# #. Author URI of the plugin/theme -msgid "http://www.christophherr.com" +msgid "https://www.christophherr.com" msgstr "" #. Description of the plugin/theme msgid "" -"Plugin wrapper to easily integrate the Woothemes Sensei plugin with the " +"Plugin wrapper to easily integrate the Automattic Sensei plugin with the " "Genesis Framework. This plugin will only work with the Genesis Framework and " "its child themes." msgstr "" diff --git a/readme.txt b/readme.txt index e0c96e9..1f168de 100644 --- a/readme.txt +++ b/readme.txt @@ -1,121 +1,140 @@ -=== Genesis Connect for Woothemes Sensei === - -Contributors: christophherr -Donate link: https://www.christophherr.com/donate/ -Tags: woothemes sensei, woothemes, genesis, genesis connect, studiopress -Requires at least: 4.1 -Tested up to: 4.8 -Stable tag: 1.1.1 -License: GPL-2.0+ -License URI: http://www.gnu.org/licenses/gpl-2.0.txt - -This plugin integrates the Genesis Framework from Studiopress with the Woothemes Sensei plugin. - -== Description == - -The base for this plugin is code taken from [WooThemes Support](https://support.woothemes.com/hc/en-us/articles/204428855-StudioPress-Genesis). - -You will need the [WooThemes Sensei](https://woocommerce.com/products/sensei/) plugin and the [Genesis Framework from Studiopress](https://www.studiopress.com) and/or one of its child themes. - -In other words, if you are not trying to integrate the Woothemes Sensei plugin with the Genesis Framework and/or one of its child themes, this plugin is pretty much useless for you... - -This plugin will only work (i.e. activate) if the Genesis Framework and its child themes and Woothemes Sensei are activated. - -Version 1.1.0 forces a content-sidebar layout on course, lesson and question posts to avoid the sidebar showing underneath the main content. - -To change this new feature, you have to use a remove_action on the code the plugin is adding. -Add remove_action( 'genesis_meta', 'gcfws_force_content_sidebar_layout' ); to your functions.php. -If you want to use a different layout, the [Studiopress Snippets](https://my.studiopress.com/snippets/admin-management/) should help to get you started. - -== Installation == - -1. Upload the entire `Genesis-Connect-for-Woothemes-Sensei` folder to your `/wp-content/plugins` directory. -2. Activate the plugin through the 'Plugins' menu in WordPress. - -Alternatively, you can - -1. Click on 'Add new' in the 'Plugins' menu -2. Type (or copy and paste) the name of this plugin into the search box -3. Click on 'Install Now' - -== Frequently Asked Questions == - -= Does this work with any WordPress theme? = - -No. This plugin only works with the Genesis Framework and its child themes. - -= Does this work with any Genesis child theme? = - -Yes and no. Technically, it does. -However, depending on other factors such as the individual theme's styling and layout, the output may be unexpected, and require some tweaking. -Case in point, if the full-width layout is selected in the Genesis settings, lessons, course and question posts are showing a sidebar underneath the main content. -That´s why a content-sidebar layout is forced on single course, lesson and questions posts since version 1.1.0. -To remove this behaviour, add remove_action( 'genesis_meta', 'gcfws_force_content_sidebar_layout' ); to your functions.php. - -= Are there any settings? = - -No. You simply activate the plugin and the necessary wrappers are inserted into your Genesis child theme. - -= How can I change how the plugin works? = - -There are no settings and no settings screen. You would have to change the code directly in the source. - -== Changelog == - -= 1.1.1 = - -* Better Code Standards. -* Removes unnecessary code. -* Updates Readme Urls. - -= 1.1.0 = - -* Adds check to only activate if Woothemes Sensei is already active. -* Forces a content-sidebar layout on single course, lesson and question posts. - To change this behaviour add remove_action( 'genesis_meta', 'gcfws_force_content_sidebar_layout' ); to your functions.php. -* After Woothemes Sensei changed their code base dramatically in the 1.9 update, - the previous method of removing the sensei wrappers started to throw error messages. - This update introduces a version check to use the appropriate array for removing the sensei wrappers. - -= 1.0.3 = - -* Corrected oversight in the original code. First closing tag should be `` instead of `` -see: [Cobalt Apps Forum] (http://cobaltapps.com/forum/forum/main-category/main-forum/81542-woo-sensei?p=82210#post82210) - -= 1.0.2 = - -* POT file added - -= 1.0.1 = - -* Loading textdomain for i18n - -= 1.0 = - -* Initial release on Github - -== Upgrade Notice == - -= 1.1.1 = - -This version removes unnecessary code, follows WordPress Coding Standards better and updates links in the Readme. - -= 1.1.0 = - -This version adds a version check for Woothemes Sensei to use the appropriate array when removing the standard Sensei wrappers. -Version 1.1.0 also forces a content-sidebar layout on single course, lesston and question posts to avoid the sidebar showing underneath the main content. -Please refer to the readme.txt if you want to remove this feature. -Woothemes Sensei has to be already active before the plugin will activate. - -= 1.0.3 = - -This version corrects an oversight in the original code -that caused issues with Cobalt Apps' Dynamik theme. - -= 1.0.2 = - -This version adds a POT file for translations. - -= 1.0.1 = - -This version loads the textdomain to enable translations. +=== Genesis Connect for Woothemes Sensei === + +Contributors: christophherr +Donate link: https://www.christophherr.com/donate/ +Tags: automattic sensei, sensei, genesis, genesis connect, studiopress, woocommerce sensei +Requires at least: 4.1 +Tested up to: 4.9 +Stable tag: 1.2.0 +License: GPL-2.0+ +License URI: http://www.gnu.org/licenses/gpl-2.0.txt + +This plugin integrates the Genesis Framework from Studiopress with the Sensei plugin. + +== Description == +The plugin expands on the [Sensei Documentation](https://docs.woocommerce.com/document/sensei-and-theme-compatibility/) about adding theme compatibility. + +You will need the [Sensei](https://woocommerce.com/products/sensei/) plugin and the [Genesis Framework from Studiopress](https://www.studiopress.com) and/or one of its child themes. + +In other words, if you are not trying to integrate the Sensei plugin with the Genesis Framework and/or one of its child themes, you don't need or want this plugin. + +This plugin will only work (i.e. activate) if the Genesis Framework and its child themes are activated. + +Version 1.1.0 forces a content-sidebar layout on course, lesson and question posts to avoid the sidebar showing underneath the main content. + +Version 1.2.0 adds the Genesis Layout options to course, lesson and question posts and archives and the module taxonomy allowing better control about the layout options. +For backwards compatibility, the single posts are still set to a content-sidebar layout but this can be overwritten by the Genesis Layout options. + +It should not be necessary to remove the formerly forced content-sidebar layout on single posts with + +remove_action( 'genesis_meta', 'gcfws_force_content_sidebar_layout_on_cpt_posts' ); + +in your functions.php anymore. Please use the Genesis Layout options instead. + +== Installation == + +1. Upload the entire `Genesis-Connect-for-Woothemes-Sensei` folder to your `/wp-content/plugins` directory. +2. Activate the plugin through the 'Plugins' menu in WordPress. + +Alternatively, you can + +1. Click on 'Add new' in the 'Plugins' menu +2. Type (or copy and paste) the name of this plugin into the search box +3. Click on 'Install Now' + +== Frequently Asked Questions == + += Does this work with any WordPress theme? = + +No. This plugin only works with the Genesis Framework and its child themes. + += Does this work with any Genesis child theme? = + +Yes and no. Technically, it does. +However, depending on other factors such as the individual theme's styling and layout, the output may be unexpected, and require some tweaking. +Case in point, if the full-width layout is selected in the Genesis settings, lessons, course and question posts are showing a sidebar underneath the main content. + +Version 1.1.0 forced a content-sidebar layout on single course, lesson and questions. +Since Version 1.2.0 the Genesis Layout options can be used to alter the appearance. + += Are there any settings? = + +You simply activate the plugin and the necessary wrappers are inserted into your Genesis child theme. + +Since version 1.2.0, you can choose the layouts of your courses, lessons, questions and modules with the Genesis Layout options. + += How can I change how the plugin works? = + +There are no settings and no settings screen. You would have to change the code directly in the source. + +== Changelog == + += 1.2.0 = + +* Adds Genesis Layout options to course, lesson, and question posts and archives and the module taxonomy. +* Previously forced content-sidebar layout can be overwritten by the Genesis Layout options. +* Updates Readme. +* More modular code structure. + += 1.1.1 = + +* Better Code Standards. +* Removes unnecessary code. +* Updates Readme Urls. + += 1.1.0 = + +* Adds check to only activate if Woothemes Sensei is already active. +* Forces a content-sidebar layout on single course, lesson and question posts. + To change this behaviour add remove_action( 'genesis_meta', 'gcfws_force_content_sidebar_layout' ); to your functions.php. +* After Woothemes Sensei changed their code base dramatically in the 1.9 update, + the previous method of removing the sensei wrappers started to throw error messages. + This update introduces a version check to use the appropriate array for removing the sensei wrappers. + += 1.0.3 = + +* Corrected oversight in the original code. First closing tag should be `` instead of `` +see: [Cobalt Apps Forum] (http://cobaltapps.com/forum/forum/main-category/main-forum/81542-woo-sensei?p=82210#post82210) + += 1.0.2 = + +* POT file added + += 1.0.1 = + +* Loading textdomain for i18n + += 1.0 = + +* Initial release on Github + +== Upgrade Notice == + += 1.2.0 = + +This version adds the Genesis Layout options to course, lesson and question posts and archives and the module taxonomy. +Please refer to the readme.txt for more information. + += 1.1.1 = + +This version removes unnecessary code, follows WordPress Coding Standards better and updates links in the Readme. + += 1.1.0 = + +This version adds a version check for Woothemes Sensei to use the appropriate array when removing the standard Sensei wrappers. +Version 1.1.0 also forces a content-sidebar layout on single course, lesston and question posts to avoid the sidebar showing underneath the main content. +Please refer to the readme.txt if you want to remove this feature. +Woothemes Sensei has to be already active before the plugin will activate. + += 1.0.3 = + +This version corrects an oversight in the original code +that caused issues with Cobalt Apps' Dynamik theme. + += 1.0.2 = + +This version adds a POT file for translations. + += 1.0.1 = + +This version loads the textdomain to enable translations. diff --git a/src/index.php b/src/index.php new file mode 100644 index 0000000..7e33169 --- /dev/null +++ b/src/index.php @@ -0,0 +1,12 @@ +version >= '1.9.0' ) { + remove_action( 'sensei_before_main_content', array( Sensei()->frontend, 'sensei_output_content_wrapper' ), 10 ); + remove_action( 'sensei_after_main_content', array( Sensei()->frontend, 'sensei_output_content_wrapper_end' ), 10 ); + return; + } + global $woothemes_sensei; + remove_action( 'sensei_before_main_content', array( $woothemes_sensei->frontend, 'sensei_output_content_wrapper' ), 10 ); + remove_action( 'sensei_after_main_content', array( $woothemes_sensei->frontend, 'sensei_output_content_wrapper_end' ), 10 ); +} + +add_action( 'sensei_before_main_content', 'gcfws_genesis_sensei_wrapper_start', 10 ); +/** + * Genesis-specific opening wrapper for Sensei + * + * @since 1.0.0 + */ +function gcfws_genesis_sensei_wrapper_start() { + echo ' '; +} diff --git a/src/site-layout/index.php b/src/site-layout/index.php new file mode 100644 index 0000000..7e33169 --- /dev/null +++ b/src/site-layout/index.php @@ -0,0 +1,12 @@ +