forked from lino/radar-wp
Add support for images to shortcode.
This commit is contained in:
parent
4ed51243b5
commit
dd31752b4b
2 changed files with 25 additions and 3 deletions
13
radar.php
13
radar.php
|
@ -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'
|
||||
//
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue