Last active
December 18, 2015 19:29
-
-
Save michael-cannon/5833704 to your computer and use it in GitHub Desktop.
Filter testimonials_widget_meta_box example
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
add_filter( 'testimonials_widget_meta_box', 'my_meta_box' ); | |
function my_meta_box( $fields ) { | |
$read_more_link = array( | |
'name' => __( 'Read More Link', 'testimonials-widget-premium' ), | |
'id' => 'testimonials-widget-read-more-link', | |
'type' => 'text', | |
'desc' => __( 'Alternate destination for "Read more" link. Leave blank for normal linking to full testimonial.', 'testimonials-widget-premium' ), | |
); | |
$fields[] = $read_more_link; | |
$is_nurse = array( | |
'name' => __( 'Nurse?', 'testimonials-widget-premium' ), | |
'id' => 'testimonials-widget-is-nurse', | |
'type' => 'select', | |
'options' => array( | |
0 => __( 'No' ), | |
1 => __( 'Yes' ), | |
), | |
'std' => 0, | |
); | |
$fields[] = $is_nurse; | |
return $fields; | |
} |
Gist should be fixed now.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
is not working (throwing errors):
Parse error: syntax error, unexpected 'public' (T_PUBLIC)
when removing 'public':
Warning: call_user_func_array() expects parameter 1 to be a valid callback, first array member is not a valid class name or object
After all $fields for testimonails_widget_meta_box doesn't contain 'testimonials-widget-read-more-link' so example IMO is not valid:
Array
(
[0] => Array
(
[name] => Job Title
[id] => testimonials-widget-title
[type] => text
[desc] =>
)
[1] => Array
(
[name] => Location
[id] => testimonials-widget-location
[type] => text
[desc] =>
)
[2] => Array
(
[name] => Email
[id] => testimonials-widget-email
[type] => text
[desc] =>
)
[3] => Array
(
[name] => Company
[id] => testimonials-widget-company
[type] => text
[desc] =>
)
[4] => Array
(
[name] => URL
[id] => testimonials-widget-url
[type] => text
[desc] =>
)
)