Created
October 18, 2015 19:40
-
-
Save slimndap/5ddb7c4e32d746691849 to your computer and use it in GitHub Desktop.
Add a 'Director: ' label in front of a custom 'director' production field. For use inside the functions.php of your theme.
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 | |
/* | |
* Adds a 'Director: ' label in front of a custom 'director' production field. | |
* @param string $value The value for the 'director' field. | |
* @param string $field The custom field name. | |
* @param WPT_Production $production The production. | |
* @return string The updated value for the 'director' field. | |
*/ | |
function wpt_add_director_label($value, $field, $production) { | |
if (!empty($value)) { | |
$value = 'Director: '.$value; | |
} | |
return $value; | |
} | |
add_filter('wpt_production_director', 'wpt_add_director_label', 10, 3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When using a plugin like Simple Fields, the custom field names may look different (eg.
_simple_fields_fieldGroupID_1_fieldID_1_numInSet_0
). In that case the code looks like this: