Skip to content

Commit

Permalink
Sync with SVN version 1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
christophherr committed Apr 3, 2018
1 parent 0a02980 commit 434b91b
Show file tree
Hide file tree
Showing 10 changed files with 392 additions and 250 deletions.
74 changes: 47 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -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 <code>remove_action( 'genesis_meta', 'gcfws_force_content_sidebar_layout' );</code> 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

<code>remove_action( 'genesis_meta', 'gcfws_force_content_sidebar_layout_on_cpt_posts' );</code>

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

Expand All @@ -50,19 +55,29 @@ 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 <code>remove_action( 'genesis_meta', 'gcfws_force_content_sidebar_layout' );</code> 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?

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.
Expand All @@ -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 `</main>` instead of `</div>`
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

Expand All @@ -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
Expand Down
135 changes: 43 additions & 92 deletions genesis-connect-for-woothemes-sensei.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<?php
/**
* Plugin Name: Genesis Connect for Woothemes Sensei
* Plugin URI: http://www.christophherr.com
* Description: Plugin wrapper to easily integrate the Woothemes Sensei plugin with the Genesis Framework. This plugin will only work with the Genesis Framework and its child themes.
* Plugin URI: https://www.christophherr.com
* Description: 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.
* Author: Christoph Herr
* Author URI: http://www.christophherr.com
* Version: 1.1.1
* Author URI: https://www.christophherr.com
* Version: 1.2.0
* Text Domain: genesis-connect-for-woothemes-sensei
* Domain Path: /languages
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* License URI: https://www.gnu.org/licenses/gpl-2.0.txt
*
* @package GenesisConnectforWoothemesSensei
* @author Christoph Herr
* @version 1.1.1
* @version 1.2.0
* @license GPL-2.0+
*
* Genesis Connect for Woothemes Sensei is free software: you can redistribute it and/or modify
Expand All @@ -35,11 +35,26 @@
wp_die( _e( 'Sorry, you are not allowed to access this page directly.', 'gcfws' ) );
}

add_action( 'plugins_loaded', 'gcfws_load_textdomain' );
/**
* Load plugin textdomain.
*
* @since 1.0.1
*
* @return void
*/
function gcfws_load_textdomain() {
load_plugin_textdomain( 'genesis-connect-for-woothemes-sensei', false, plugin_basename( dirname( __FILE__ ) ) . '/languages' );
}

register_activation_hook( __FILE__, 'gcfws_activation' );
/**
* This function runs on plugin activation. It checks to make sure the
* Genesis Framework and Woothemes Sensei are active. If not, it deactivates the plugin.
*
* @since 1.0
* @since 1.0.0
*
* @return void
*/
function gcfws_activation() {
if ( ! function_exists( 'genesis' ) ) {
Expand All @@ -49,13 +64,15 @@ function gcfws_activation() {
}
}

register_activation_hook( __FILE__, 'gcfws_activation' );

add_action( 'admin_init', 'gcfws_plugin_deactivate' );
add_action( 'switch_theme', 'gcfws_plugin_deactivate' );
/**
* This function is triggered when the WordPress theme is changed.
* It checks if the Genesis Framework is active. If not, it deactivates the plugin.
*
* @since 1.0
* @since 1.0.0
*
* @return void
*/
function gcfws_plugin_deactivate() {
if ( ! function_exists( 'genesis' ) ) {
Expand All @@ -65,103 +82,37 @@ function gcfws_plugin_deactivate() {
}
}

add_action( 'admin_init', 'gcfws_plugin_deactivate' );
add_action( 'switch_theme', 'gcfws_plugin_deactivate' );

/**
* Error message if you're not using the Genesis Framework.
*
* @since 1.0
* @since 1.0.0
*
* @return void
*/
function gcfws_admin_notice_message() {
$error = sprintf( _e( 'Sorry, you can\'t use the Genesis Connect for Woothemes Sensei Plugin unless the <a href="%s">Geneis Framework</a> 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 <a href="%s">Genesis Framework</a> is active. The plugin has been deactivated.', 'gcfws' ),
'http://www.studiopress.com'
);

echo '<div class="error"><p>' . $error . '</p></div>';
printf( '<div class="error"><p>%s</p></div>', $error );

if ( isset( $_GET['activate'] ) ) {
unset( $_GET['activate'] );
}
}

/**
* 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 '<div class="content-sidebar-wrap"><main class="content" role="main" itemprop="mainContentOfPage">';
}

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'</main> <!-- end main-->';
get_sidebar();
echo'</div> <!-- end .content-sidebar-wrap-->';
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();
12 changes: 12 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php
/**
* Index.
*
* @package GenesisConnectforWoothemesSensei
* @since 1.2.0
* @author Christoph Herr
* @link https://www.christophherr.com
* @license GNU General Public License 2.0+
*/

// Nothing to see here.
21 changes: 11 additions & 10 deletions languages/genesis-connect-for-woothemes-sensei.pot
Original file line number Diff line number Diff line change
@@ -1,43 +1,44 @@
# Copyright (C) 2015 Genesis Connect for Woothemes Sensei
# Copyright (C) 2018 Genesis Connect for Woothemes Sensei
# This file is distributed under the same license as the Genesis Connect for Woothemes Sensei package.
msgid ""
msgstr ""
"Project-Id-Version: Genesis Connect for Woothemes Sensei 1.0.1\n"
"Project-Id-Version: Genesis Connect for Woothemes Sensei 1.2.0\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/genesis-connect-"
"for-woothemes-sensei\n"
"POT-Creation-Date: 2015-10-13 03:35:28+00:00\n"
"POT-Creation-Date: 2018-04-03 01:10:48+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"PO-Revision-Date: 2015-MO-DA HO:MI+ZONE\n"
"PO-Revision-Date: 2018-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"

#: genesis-connect-for-woothemes-sensei.php:35
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 <a href=\"%s\">Geneis Framework</a> is active. The plugin has been "
"the <a href=\"%s\">Genesis Framework</a> is active. The plugin has been "
"deactivated."
msgstr ""

#. Plugin Name of the plugin/theme
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 ""
Expand Down
Loading

0 comments on commit 434b91b

Please sign in to comment.