Skip to content

Commit

Permalink
Add the ability to pass a called function to the field description
Browse files Browse the repository at this point in the history
  • Loading branch information
mihdan committed Feb 7, 2021
1 parent 1e5d325 commit e11a6a1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/WPOSA.php
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,12 @@ function get_sanitize_callback( $slug = '' ) {
*/
public function get_field_description( $args ) {
if ( ! empty( $args['desc'] ) ) {
$desc = sprintf( '<p class="description">%s</p>', $args['desc'] );
$desc = sprintf(
'<p class="description">%s</p>',
is_callable( $args['desc'] )
? call_user_func( $args['desc'] )
: $args['desc']
);
} else {
$desc = '';
}
Expand Down

0 comments on commit e11a6a1

Please sign in to comment.