Skip to content

Instantly share code, notes, and snippets.

@robneu
Last active January 17, 2017 19:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robneu/fd05a8c3f7b3f5e56d48c2131692abff to your computer and use it in GitHub Desktop.
Save robneu/fd05a8c3f7b3f5e56d48c2131692abff to your computer and use it in GitHub Desktop.
Change the default template strings in Cookbook for WordPress
<?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