1
0
Fork 0
forked from lino/radar-wp

Add support for images to shortcode.

This commit is contained in:
ekes 2017-06-09 15:28:57 +01:00
parent 4ed51243b5
commit dd31752b4b
2 changed files with 25 additions and 3 deletions

View file

@ -41,6 +41,7 @@ function radar_shortcode_events($attributes, $content = '') {
'price_category:title',
'price',
'link',
'image:url',
'body',
'group:title',
'group:url',
@ -193,6 +194,18 @@ function radar_shortcode_field_url_value($field, $type, $item, $parents, $shortc
}
add_filter('radar_shortcode_field_value', 'radar_shortcode_field_url_value', 12, 5);
/**
* Format image.
*/
function radar_shortcode_image_value($field, $type, $item, $parents, $shortcode) {
if ($type == 'image' && $field['field'] == 'url' && $field['value']) {
$field['output'] = '<img src="'. $field['value'] .'" \>';
}
return $field;
}
add_filter('radar_shortcode_field_value', 'radar_shortcode_image_value', 12, 5);
//
// 'radar_shortcode_field_html'
//