You can create custom tag and use any custom field
eg for Acf custom field ‘project_image’
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
Locate_And_Filter_Addon_Helper::define_custom_tags( array( 'project_image' =>'project_image'), 'all', 'getDataCallbackFn_place_tags', 'project_image' ); function getDataCallbackFn_place_tags( $field, $id){ $html = ''; ob_start(); $project_image = get_field('project_image', $id); echo '<a href="'.$project_image.'"><img src="'.$project_image.'" style="width:300px;">'; $html .= ob_get_contents(); ob_end_clean(); return $html; } |
or eg for other custom field ‘project_image’
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
Locate_And_Filter_Addon_Helper::define_custom_tags( array( 'project_image' =>'project_image'), 'all', 'getDataCallbackFn_place_tags', 'project_image' ); function getDataCallbackFn_place_tags( $field, $id){ $html = ''; ob_start(); $project_image = get_post_meta($id, 'project_image', true); echo '<a href="'.$project_image.'"><img src="'.$project_image.'" style="width:300px;">'; $html .= ob_get_contents(); ob_end_clean(); return $html; } |
demo
template
admin