Changeset 1369562
- Timestamp:
- 03/11/2016 11:20:34 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
genesis-connect-for-woothemes-sensei/trunk/genesis-connect-for-woothemes-sensei.php
r1272292 r1369562 6 6 * Author: Christoph Herr 7 7 * Author URI: http://www.christophherr.com 8 * Version: 1. 0.38 * Version: 1.1.0 9 9 * Text Domain: genesis-connect-for-woothemes-sensei 10 10 * Domain Path: /languages … … 14 14 * @package GenesisConnectforWoothemesSensei 15 15 * @author Christoph Herr 16 * @version 1. 0.316 * @version 1.1.0 17 17 * @license GPL-2.0+ 18 18 * … … 38 38 /** 39 39 * This function runs on plugin activation. It checks to make sure the 40 * Genesis Framework isactive. If not, it deactivates the plugin.40 * Genesis Framework and Woothemes Sensei are active. If not, it deactivates the plugin. 41 41 * 42 42 * @since 1.0 … … 47 47 deactivate_plugins( plugin_basename( __FILE__ ) ); 48 48 add_action( 'admin_notices', 'gcfws_admin_notice_message' ); 49 } 50 if ( ! class_exists( ('Sensei_Main' ) || ( 'WooThemes_Sensei' ) ) ) { 51 // Deactivate. 52 deactivate_plugins( plugin_basename( __FILE__ ) ); 53 add_action( 'admin_notices', 'gcfws_admin_notice_message_sensei' ); 49 54 } 50 55 } … … 85 90 86 91 /** 92 * Error message if you're not using Woothemes Sensei. 93 * 94 * @since 1.1 95 */ 96 function gcfws_admin_notice_message_sensei() { 97 $error = sprintf( _e( 'Sorry, you can\'t use the Genesis Connect for Woothemes Sensei Plugin unless the <a href="%s">Sensei Plugin</a> is active. The plugin has been deactivated.', 'gcfws' ), 'http://senseilms.com' ); 98 99 echo '<div class="error"><p>' . $error . '</p></div>'; 100 101 if ( isset( $_GET['activate'] ) ) { 102 unset( $_GET['activate'] ); 103 } 104 } 105 106 /** 87 107 * Load plugin textdomain. 88 108 * … … 108 128 109 129 /** 110 * Remove the default Sensei wrappers 130 * Force content-sidebar layout on Woothemes Sensei Course, Lesson and Question pages. 131 * @since 1.1 111 132 */ 112 global $woothemes_sensei; 113 remove_action( 'sensei_before_main_content', array( $woothemes_sensei->frontend, 'sensei_output_content_wrapper' ), 10 ); 114 remove_action( 'sensei_after_main_content', array( $woothemes_sensei->frontend, 'sensei_output_content_wrapper_end' ), 10 ); 133 function gcfws_force_content_sidebar_layout() { 134 if ( is_singular( array( 'course', 'lesson', 'question' ) ) ) { 135 add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_content_sidebar' ); 136 } 137 } 138 139 add_action( 'genesis_meta', 'gcfws_force_content_sidebar_layout' ); 140 141 /** 142 * Remove the default Woothemes Sensei wrappers. 143 * Checks which version of Woothemes Sensei is running 144 * and removes the wrappers accordingly. 145 * @since 1.1 146 */ 147 function gcfws_remove_default_sensei_wrappers() { 148 149 if ( Sensei()->version >= '1.9.0' ) { 150 remove_action( 'sensei_before_main_content', array( Sensei()->frontend, 'sensei_output_content_wrapper' ), 10 ); 151 remove_action( 'sensei_after_main_content', array( Sensei()->frontend, 'sensei_output_content_wrapper_end' ), 10 ); 152 return; 153 } 154 global $woothemes_sensei; 155 remove_action( 'sensei_before_main_content', array( $woothemes_sensei->frontend, 'sensei_output_content_wrapper' ), 10 ); 156 remove_action( 'sensei_after_main_content', array( $woothemes_sensei->frontend, 'sensei_output_content_wrapper_end' ), 10 ); 157 } 158 159 add_action( 'genesis_meta', 'gcfws_remove_default_sensei_wrappers' ); 115 160 116 161
Note: See TracChangeset
for help on using the changeset viewer.