Last active
August 29, 2015 14:16
-
-
Save woogist/1fbcb133dddb0d79647f to your computer and use it in GitHub Desktop.
The code in below will integrate Sensei with the Choices theme from Krisi. Add the code below into your themes functions.php file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/********************* | |
* Sensei Integration | |
*********************/ | |
/** | |
* Declare that your theme now supports Sensei | |
*/ | |
add_action( 'after_setup_theme', 'sensei_support' ); | |
function sensei_support() { | |
add_theme_support( 'sensei' ); | |
} | |
/** | |
* Remove the default Sensei wrappers | |
*/ | |
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 ChoicesTheme custom Sensei content wrappers | |
*/ | |
add_action('sensei_before_main_content', 'choices_sensei_wrapper_start', 10); | |
add_action('sensei_after_main_content', 'choices_sensei_wrapper_end', 10); | |
function choices_sensei_wrapper_start() { | |
echo get_choices_sensei_single_title(); | |
echo '<div class="container_wrap main_color sidebar_right">'. | |
'<div class="container">'. | |
'<div class="template-page content eight alpha units">'; | |
} | |
function choices_sensei_wrapper_end() { | |
echo ' </div> <!-- .content -->'; | |
get_sidebar(); | |
echo'</div> <!-- end #container-->'; | |
echo'</div> <!-- end #container_wrap-->'; | |
} | |
/** | |
* remove default sensei titles | |
*/ | |
remove_action( 'sensei_course_single_title', array( $woothemes_sensei->frontend , 'sensei_single_title' ), 10 ); | |
remove_action( 'sensei_lesson_single_title', array( $woothemes_sensei->frontend , 'sensei_single_title' ), 10 ); | |
remove_action( 'sensei_quiz_single_title', array( $woothemes_sensei->frontend, 'sensei_single_title' ), 10 ); | |
remove_action( 'sensei_message_single_title', array( $woothemes_sensei->frontend, 'sensei_single_title' ), 10 ); | |
function get_choices_sensei_single_title() { | |
global $post; | |
$title = $post->post_title; | |
if( is_singular( 'sensei_message' ) ) { | |
$content_post_id = get_post_meta( $post->ID, '_post', true ); | |
if( $content_post_id ) { | |
$title = sprintf( __( 'Re: %1$s', 'woothemes-sensei' ), get_the_title( $content_post_id ) ); | |
} else { | |
$title = get_the_title( $post->ID ); | |
} | |
} | |
$t_link = get_permalink( $post->ID ); | |
$t_sub = ""; | |
return avia_title(array('title' => $title, 'link' => $t_link, 'subtitle' => $t_sub)); | |
} | |
/*************************** | |
* // END Sensei Integration | |
****************************/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment