Title: Shortcode with custom image field?
Last modified: August 21, 2016

---

# Shortcode with custom image field?

 *  [zebrastribe](https://wordpress.org/support/users/zebrastribe/)
 * (@zebrastribe)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/shortcode-with-custom-image-field/)
 * Hi
 * I cannot get the image from one of my fields into a shortcode.
    (it works with
   get_the_post_thumbnail($post->ID, ‘thumbnail’) But i need the value from the 
   field “udstiller logo”
 * Here is my code
 *     ```
       function logo_shortcode( $atts ) {
       	extract( shortcode_atts( array(
       		'limit' => '50',
       		'orderby' => 'name',
       	), $atts ) );
       	// Creating custom query to fetch the project type custom post.
       	$loop = new WP_Query(array('post_type' => 'udstillere', 'posts_per_page' => $limit, 'orderby' => $orderby));
       	$output = '<ul class="bxslider">';
       	// Looping through the posts and building the HTML structure.
       	if($loop){
       		while ($loop->have_posts()){
       			 $loop->the_post();
       			 $output .= '<li><a href="'.get_permalink().'"><img src="'.get_post_meta($post->ID,'wpcf-udstiller-logo',true).'"/></a></li>';
   
       		}
       	}
       	else
       		$output = 'Sorry, No projects yet. Come back Soon.';
       	// Now we are returning the HTML code back to the place from where the shortcode was called.
       	return $output;
       	$output = '</ul>';
       }
       add_shortcode("Logo", "logo_shortcode");
       ```
   
 * [http://wordpress.org/extend/plugins/types/](http://wordpress.org/extend/plugins/types/)

Viewing 1 replies (of 1 total)

 *  [Bigul Malayi](https://wordpress.org/support/users/mbigul/)
 * (@mbigul)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/shortcode-with-custom-image-field/#post-3875814)
 * Dear zebrastribe,
 * Please refer following tutorial links
 * [http://wp-types.com/documentation/functions/#Image](http://wp-types.com/documentation/functions/#Image)
 * [http://wp-types.com/documentation/functions/](http://wp-types.com/documentation/functions/)
 * _[ [Signature moderated.](http://codex.wordpress.org/Forum_Welcome#Signatures)]_

Viewing 1 replies (of 1 total)

The topic ‘Shortcode with custom image field?’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/types_ced1d3.svg)
 * [Toolset Types - Custom Post Types, Custom Fields and Taxonomies](https://wordpress.org/plugins/types/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/types/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/types/)
 * [Active Topics](https://wordpress.org/support/plugin/types/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/types/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/types/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Bigul Malayi](https://wordpress.org/support/users/mbigul/)
 * Last activity: [12 years, 11 months ago](https://wordpress.org/support/topic/shortcode-with-custom-image-field/#post-3875814)
 * Status: not resolved