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;
 }
 function ac_page_title_header_style($post = 0)
 {
     global $ac_full_width_pixels;
     $post = get_post($post);
     // Only return style for custom header
     $page_title_type = ac_get_meta('page_title_type');
     if ($page_title_type == 'custom') {
         $bg_color = ac_get_meta('page_title_bg_color');
         if ($bg_color) {
             $bg_color = 'background-color: ' . $bg_color . '; ';
         }
         $bg_img = ac_get_meta('page_title_image', array('type' => 'image_advanced'));
         $bg_img_style = '';
         if ($bg_img) {
             $bg_img = $bg_img[key($bg_img)];
             // Resize to max allowed for site
             $img_args = array('image_id' => $bg_img['ID'], 'width' => ac_get_full_width_px(), 'height' => 600);
             $image = ac_resize_image($img_args);
             $bg_img_style = 'background-image: url(' . $image['url'] . '); ';
         }
         return $bg_color . $bg_img_style;
     }
     return '';
 }
Exemplo n.º 3
0
function ac_resize_image($args)
{
    // Defaults
    $defaults = array("image_id" => null, "width" => ac_get_full_width_px(), "height" => null, 'crop' => true);
    $args = wp_parse_args($args, $defaults);
    extract($args);
    if ($height == null) {
        $height = $width;
    }
    $image = shoestrap_image_resize(array('id' => $image_id, 'url' => wp_get_attachment_url($image_id), 'width' => $width, 'height' => $height, 'crop' => $crop));
    return $image;
}