Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // change product titles in all caps to title case
- add_filter( 'the_title', 'custom_title_format' );
- function custom_title_format( $title ) {
- if( is_shop() || is_product_category() || is_product() ) {
- $words = explode( " ", $title );
- $title = "";
- foreach( $words as $word ) {
- $word = ucfirst( strtolower( $word ) );
- $title = $title.$word." ";
- }
- return trim( $title );
- }
- // return the normal Title if conditions aren't met
- return $title;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement