Created
February 24, 2015 23:10
-
-
Save woogist/adc7d013a478e1674510 to your computer and use it in GitHub Desktop.
The code below allow for Cyberchimps - Pro starter theme to be integrated with Sensei.
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
/** | |
* 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 Cyberchimps specific custom Sensei content wrappers | |
*/ | |
add_action('sensei_before_main_content', 'cyberchimps_sensei_wrapper_start', 10); | |
add_action('sensei_after_main_content', 'cyberchimps_sensei_wrapper_end', 10); | |
function cyberchimps_sensei_wrapper_start() { | |
echo '<div class="container-full-width" id="page_section_section"> | |
<div class="container"> | |
<div class="container-fluid"> | |
<div id="container" class="row-fluid"> | |
<div id="content" class=" span9 content-sidebar-right">'; | |
} | |
function cyberchimps_sensei_wrapper_end() { | |
do_action( 'cyberchimps_after_content'); | |
echo ' </div><!-- #content -->'; | |
do_action( 'cyberchimps_after_content_container'); | |
echo '</div><!-- #container .row-fluid-->'; | |
do_action( 'cyberchimps_after_container'); | |
echo'</div><!--container fluid -->'; | |
echo '</div><!-- .container -->'; | |
echo '</div><!-- container-full-width -->'; | |
} | |
/** | |
* 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 ); | |
/** | |
* Add custom theme title: | |
*/ | |
add_action( 'sensei_course_single_title', 'cyberchimps_sensei_single_title', 10 ); | |
add_action( 'sensei_lesson_single_title', 'cyberchimps_sensei_single_title', 10 ); | |
add_action( 'sensei_quiz_single_title', 'cyberchimps_sensei_single_title', 10 ); | |
add_action( 'sensei_message_single_title', 'cyberchimps_sensei_single_title' , 10 ); | |
function cyberchimps_sensei_single_title() { | |
global $post; | |
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' ), '<a href="' . get_permalink( $content_post_id ) . '">' . get_the_title( $content_post_id ) . '</a>' ); | |
} else { | |
$title = get_the_title( $post->ID ); | |
} | |
} else { | |
$title = get_the_title(); | |
} | |
?> | |
<header class="entry-header"> <h1 class="entry-title"> | |
<?php echo $title;?> | |
</h1></header> | |
<?php | |
} // End cyberchimps_sensei_single_title() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment