Friday 15 August 2014

php - Wordpress getting thumnails of images in custom fields -



php - Wordpress getting thumnails of images in custom fields -

in current wordpress customisation project, have custom image upload fields custom post types. on front end end receive info these custom fields , ie. urls of these custom images using function get_post_meta( ).but in case original total sized image uploaded through meta box.how can thumbnail of uploaded meta field.there more 1 image fields post type.here current code getting images

$meta = get_post_meta( $post_id ); //print_r($meta); $client = $meta['client'][0]; $channel = $meta['channel'][0]; $logistics = $meta['logistics'][0]; $head = $meta['headline2'][0]; $img1 = isset($meta['image1'])?$meta['image1']:'';//image field 1 $img2 = isset($meta['image2'])?$meta['image2']:'';//image field 2 $img3 = isset($meta['image3'])?$meta['image3']:'';//image field 3

please check link adding images posts. http://justintadlock.com/archives/2007/10/27/wordpress-custom-fields-adding-images-to-posts or seek wp_get_attachment_image_src() $attachment_id = get_field('field_name'); $size = "medium"; // (thumbnail, medium, large, total or custom size) $image = wp_get_attachment_image_src( $attachment_id, $size );

php wordpress

No comments:

Post a Comment