Last active
January 17, 2017 19:05
-
-
Save robneu/fd05a8c3f7b3f5e56d48c2131692abff to your computer and use it in GitHub Desktop.
Change the default template strings in Cookbook for WordPress
This file contains 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
<?php | |
add_filter( 'cookbook_strings', 'prefix_custom_strings' ); | |
/** | |
* Modify the default template strings in Cookbook. | |
* | |
* @since 1.0.0 | |
* @param array $strings The default template strings. | |
* @return array | |
*/ | |
function prefix_custom_strings( $strings ) { | |
$strings['prep_time_title'] = __( 'Prep Time', 'theme-textdomain' ); | |
$strings['cook_time_title'] = __( 'Cook Time', 'theme-textdomain' ); | |
$strings['inactive_time_title'] = __( 'Inactive Time', 'theme-textdomain' ); | |
$strings['total_time_title'] = __( 'Total Time', 'theme-textdomain' ); | |
return $strings; | |
} | |
add_filter( 'cookbook_time_labels', 'prefix_custom_time_labels', 10, 2 ); | |
/** | |
* Modify the default time labels in Cookbook. | |
* | |
* @since 1.0.0 | |
* @param array $labels The default time labels. | |
* @param array $time The time to use when formatting the label. | |
* @return array | |
*/ | |
function prefix_custom_time_labels( $labels, $time ) { | |
$labels['hours'] = _n( 'hour', 'hour', $time['hours'], 'theme-textdomain' ); | |
$labels['minutes'] = _n( 'minute', 'minutes', $time['minutes'], 'theme-textdomain' ); | |
$labels['seconds'] = _n( 'second', 'seconds', $time['seconds'], 'theme-textdomain' ); | |
return $labels; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment