get_var( "SELECT ID FROM $wpdb->posts WHERE (post_title = '{$vendor_name}' and post_type = '{$post_type}') ;"); } function affpromos_get_vendor_thumbnail( $postid = null, $size = null ) { if ( empty ( $postid ) ) $postid = get_the_ID(); // Get thumbnail from promotion $image_size = ( 'small' === $size ) ? 'affpromos-thumb-small' : 'affpromos-thumb'; $images = rwmb_meta( AFFILIATE_PROMOTIONS_PREFIX . 'vendor_image', 'size=' . $image_size, $postid ); if( ! empty ( $images ) ) { if (is_numeric($images)) { return array( 'url'=> get_the_guid($images), 'alt'=> get_the_title($images), ); } return array_shift( $images ); } // No thumbnail found return false; }