Exemplo n.º 1
0
 function tb_ad_featured_thumbnail()
 {
     global $post;
     // go see if any images are associated with the ad
     $image_id = cp_get_featured_image_id($post->ID);
     // set the class based on if the hover preview option is set to "yes"
     if (get_option('cp_ad_image_preview') == 'yes') {
         $prevclass = 'preview';
     } else {
         $prevclass = 'nopreview';
     }
     if ($image_id > 0) {
         // get 50x50 v3.0.5+ image size
         $adthumbarray = wp_get_attachment_image($image_id, 'ad-small');
         // grab the large image for onhover preview
         $adlargearray = wp_get_attachment_image_src($image_id, 'large');
         $img_large_url_raw = $adlargearray[0];
         // must be a v3.0.5+ created ad
         if ($adthumbarray) {
             echo '<a href="' . get_permalink() . '" title="' . the_title_attribute('echo=0') . '" class="' . $prevclass . '" data-rel="' . $img_large_url_raw . '">' . $adthumbarray . '</a>';
             // maybe a v3.0 legacy ad
         } else {
             $adthumblegarray = wp_get_attachment_image_src($image_id, 'ad-small');
             $img_thumbleg_url_raw = $adthumblegarray[0];
             echo '<a href="' . get_permalink() . '" title="' . the_title_attribute('echo=0') . '" class="' . $prevclass . '" data-rel="' . $img_large_url_raw . '">' . $adthumblegarray . '</a>';
         }
         // no image so return the placeholder thumbnail
     } else {
         echo '<a href="' . get_permalink() . '" title="' . the_title_attribute('echo=0') . '"><img class="attachment-sidebar-thumbnail" alt="" title="" src="' . get_stylesheet_directory_uri() . '/images/no-thumb-100.jpg" /></a>';
     }
 }
 function cp_ad_featured_thumbnail()
 {
     global $post, $cp_options;
     // go see if any images are associated with the ad
     $image_id = cp_get_featured_image_id($post->ID);
     // set the class based on if the hover preview option is set to "yes"
     $prevclass = $cp_options->ad_image_preview ? 'preview' : 'nopreview';
     if ($image_id > 0) {
         // get 155x208 v3.0.5+ image size
         $adthumbarray = wp_get_attachment_image($image_id, 'ad-feater-slider');
         // grab the large image for onhover preview
         $adlargearray = wp_get_attachment_image_src($image_id, 'large');
         $img_large_url_raw = $adlargearray[0];
         // must be a v3.0.5+ created ad
         if ($adthumbarray) {
             echo '<a href="' . get_the_permalink($post->ID) . '" title="' . the_title_attribute('echo=0') . '" class="' . $prevclass . '" data-rel="' . $img_large_url_raw . '">' . $adthumbarray . '</a>';
             //echo '<a href="'. get_permalink() .'" title="'. the_title_attribute('echo=0') .'" class="'.$prevclass.'" data-rel="'.$img_large_url_raw.'">'.$adthumbarray.'</a>';
             // maybe a v3.0 legacy ad
         } else {
             $adthumblegarray = wp_get_attachment_image_src($image_id, 'thumbnail');
             $img_thumbleg_url_raw = $adthumblegarray[0];
             echo '<a href="' . get_permalink() . '" title="' . the_title_attribute('echo=0') . '" class="' . $prevclass . '" data-rel="' . $img_large_url_raw . '">' . $adthumblegarray . '</a>';
         }
         // no image so return the placeholder thumbnail
     } else {
         echo '<a href="' . get_permalink() . '" title="' . the_title_attribute('echo=0') . '"><img class="attachment-sidebar-thumbnail" alt="" title="" src="' . appthemes_locate_template_uri('images/no-thumb-sm.jpg') . '" /></a>';
     }
 }