Created
October 15, 2015 00:28
-
-
Save woogist/521a7fa8808a13228279 to your computer and use it in GitHub Desktop.
Remove the extra 'Quiz' on the single quiz page
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
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