shortcode_was_rendered = true; // Set the attributes, default or passed in shortcode // $adpressAttributes = shortcode_atts( array( 'id' => $adpress_plugin->settings->get_item('adid', -1), 'shorthand' => $adpress_plugin->settings->get_item('shorthand','') ), $params ); $custom = array(); // Use shorthand to get ID if ID not set // if ( ( ($adpressAttributes['id'] < 0) || ($adpressAttributes['id'] === '') ) && ($adpressAttributes['shorthand'] != '') ){ $postInfo = get_posts( array( 'post_type' => 'adpress_ad', 'name' => $adpressAttributes['shorthand'] ) ); $adpressAttributes['id'] = $postInfo[0]->ID; } // If ID is set, use that to get custom fields if ($adpressAttributes['id'] > 0) { // Post type is not an adpress ad - get out // if (get_post_type($adpressAttributes['id']) != 'adpress_ad') { return; } // Get the attributes for the ad // $adpressAttributes = array_merge($adpressAttributes, get_post_custom($adpressAttributes['id'])); // Set The Image $adpressAttributes['thumbnails'] = wp_get_attachment_image_src( get_post_thumbnail_id( $adpressAttributes['id'] ) ); // Setup The Ad // return '' . ''. '' ; } return ''; } } }