function shoestrap_featured_image($full_width = false, $link = true, $square = false, $width = false, $height = false)
 {
     add_theme_support('post-thumbnails');
     if (!has_post_thumbnail() || '' == get_the_post_thumbnail()) {
         // Get the URL of the blank image
         return;
     }
     // Get the width
     if ($full_width) {
         $data['width'] = ac_get_full_width_px();
     } else {
         $data['width'] = shoestrap_content_width_px();
     }
     $data['height'] = shoestrap_getVariable('ac_feat_img_height');
     // AC - new setting
     if (is_single() || is_page()) {
         if (shoestrap_getVariable('feat_img_post') != 1) {
             return;
         }
         // Do not process if we don't want images on single posts
         $data['url'] = wp_get_attachment_url(get_post_thumbnail_id());
         if (shoestrap_getVariable('feat_img_post_custom_toggle') == 1) {
             $data['width'] = shoestrap_getVariable('feat_img_post_width');
             $data['height'] = shoestrap_getVariable('feat_img_post_height');
         }
     } else {
         if (shoestrap_getVariable('feat_img_archive') == 0) {
             return;
         }
         // Do not process if we don't want images on post archives
         $data['url'] = wp_get_attachment_url(get_post_thumbnail_id());
         if (shoestrap_getVariable('feat_img_archive_custom_toggle') == 1) {
             $data['width'] = shoestrap_getVariable('feat_img_archive_width');
             $data['height'] = shoestrap_getVariable('feat_img_archive_height');
         }
     }
     // Check for square image
     if ($square) {
         $data['height'] = $data['width'];
     }
     // Check for width and height overrides
     if ($height) {
         $data['height'] = $height;
     }
     if ($width) {
         $data['width'] = $width;
     }
     //AC - alt
     $alt = "alt='" . ac_get_image_alt(get_post_thumbnail_id()) . "'";
     $image = shoestrap_image_resize($data);
     $output = '<img class="featured-image" src="' . $image['url'] . '" ' . $alt . ' />';
     if ($link) {
         $output = '<a href="' . get_permalink() . '">' . $output . '</a>';
     }
     echo $output;
 }
Example #2
0
function ac_resize_image_for_grid($args)
{
    // Defaults
    $defaults = array("image_id" => null, "columns" => null, "ratio" => AC_IMAGE_RATIO_3BY2);
    $args = wp_parse_args($args, $defaults);
    extract($args);
    // Resize
    $image = ac_resize_image_for_columns($args);
    // Return HTML
    return '<img class="grid-image" src="' . $image['url'] . '" alt="' . esc_attr(ac_get_image_alt($image_id)) . '" />';
}