How can I change a word or phrase somewhere?

As you customize the theme for your sports team, it is possible you may run into a word or a phrase that you want changed. The first step is figuring out the right way to change that particular word.

  1. First explore the WordPress admin and make sure you can’t already do it in there. Sports Team Theme offers many options for customizing the theme that cover 98% of the cases out there. Learn about how to change the verbiage in these areas:
  2. If you have a good understanding of all of those areas, and you still are not able to customize the text that you want, you will either need to use a plugin like Say What?, or you can do it more manually:

    You can make use of WordPress’ language functions to override the text that you want. In order for this to work, you will need to make sure that the text you are wanting to replace actually exists in the theme files, and is not created dynamically.

    1. First, create a Child theme. This is necessary so that when the theme gets updated, you’ll be able to update and not worry about your changes being lost.
    2. After you’ve created a child theme, create a new blank functions.php file in your child theme.
    3. Customize the code below based on your needs. It works by identifying what words/phrases you want to find, and then what words/phrases you want to replace it with:
function spt_replace_phrase( $phrasereplaced ) { 
	$phrases = array( 
		'Old Phrase 1' => 'New Phrase 1', 
		'Old Phrase 2' => 'New Phrase 2', 
		'Old Phrase 3' => 'New Phrase 3',
	);
	$phrasereplaced = str_ireplace( array_keys($phrases), $phrases, $phrasereplaced ); 
	return $phrasereplaced; 
}
add_filter( 'gettext', 'spt_replace_phrase', 20 );