Add filters to convert statistic slugs to alphabetic strings

This commit is contained in:
ThemeBoy
2013-11-27 03:10:49 +11:00
parent 639f4b86da
commit 68fa7f30d4
10 changed files with 204 additions and 59 deletions

View File

@@ -42,4 +42,26 @@ function sportspress_the_content( $content ) {
return $content;
}
add_filter('the_content', 'sportspress_the_content');
function sp_sanitize_title( $title ) {
if ( in_array( $_POST['post_type'], array( 'sp_result', 'sp_outcome', 'sp_stat', 'sp_metric' ) ) ):
// Get post title
$title = $_POST['post_title'];
// String to lowercase
$title = strtolower( $title );
// Replace all numbers with words
$title = sp_numbers_to_words( $title );
// Remove all other non-alphabet characters
$title = preg_replace( "/[^a-z]/", '', $title );
endif;
return $title;
}
add_filter( 'sanitize_title', 'sp_sanitize_title' );
?>