Skip to content

Instantly share code, notes, and snippets.

@woogist
Created October 15, 2015 00:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save woogist/521a7fa8808a13228279 to your computer and use it in GitHub Desktop.
Save woogist/521a7fa8808a13228279 to your computer and use it in GitHub Desktop.
Remove the extra 'Quiz' on the single quiz page
add_filter( 'sensei_single_title', 'sensei_dl_custom_double_quiz_remove' );
function sensei_dl_custom_double_quiz_remove( $title ){
if( 'quiz' == get_post_type()
&& 1 < substr_count( strtoupper( $title ), 'QUIZ' ) ){
// remove all possible appearances of quiz
$title_with_no_quizzes = str_replace( 'quiz', '', $title );
$title_with_no_quizzes = str_replace( 'Quiz', '', $title_with_no_quizzes );
$title_with_no_quizzes = str_replace( 'Quiz', '', $title_with_no_quizzes );
return $title_with_no_quizzes . __( 'Quiz', 'woothemes-sensei');
}
return $title;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment