function featured_image() { global $ss_framework, $ss_settings; $data = array(); if (!has_post_thumbnail() || '' == get_the_post_thumbnail()) { return; } $data['width'] = Shoestrap_Layout::content_width_px(); if (is_singular()) { // Do not process if we don't want images on single posts if ($ss_settings['feat_img_post'] != 1) { return; } $data['url'] = wp_get_attachment_url(get_post_thumbnail_id()); if ($ss_settings['feat_img_post_custom_toggle'] == 1) { $data['width'] = $ss_settings['feat_img_post_width']; } $data['height'] = $ss_settings['feat_img_post_height']; } else { // Do not process if we don't want images on post archives if ($ss_settings['feat_img_archive'] != 1) { return; } $data['url'] = wp_get_attachment_url(get_post_thumbnail_id()); if ($ss_settings['feat_img_archive_custom_toggle'] == 1) { $data['width'] = $ss_settings['feat_img_archive_width']; } $data['height'] = $ss_settings['feat_img_archive_height']; } $image = Shoestrap_Image::image_resize($data); echo $ss_framework->clearfix() . '<a href="' . get_permalink() . '"><img class="featured-image ' . $ss_framework->float_class('left') . '" src="' . $image['url'] . '" /></a>'; }
function ssep_featured_content_template() { global $ss_framework, $ss_settings, $post; $featured_posts = shoestrap_get_featured_posts(); if (empty($featured_posts)) { return; } // Build the image arguments that we'll need $data = array(); // Get the image width if ('fluid' == $ss_settings['site_style']) { // On fluid layouts set the image width to the 'screen_tablet' width (normally 768px). $data['width'] = $ss_settings['screen_tablet']; } else { // On non-fluid layouts, set the width of the image to 1/3 of the total site width. $data['width'] = $ss_settings['screen_large_desktop'] / 3; } // Calculate the image height using the golden ratio analogy. $data['height'] = intval($data['width'] / 1.61803398875); $data['crop'] = true; // Should we crop? (boolean) $data['retina'] = true; // Enable or disable retina images (boolean) $data['resize'] = true; // Should we resize the image (boolean) $column_class = $ss_framework->column_classes(array('tablet' => 4), 'string'); $i = 0; echo '<div id="featured-content" class="featured-content jumbotron">'; echo $ss_framework->open_container(); foreach ((array) $featured_posts as $order => $post) { $i++; setup_postdata($post); ?> <article <?php post_class($column_class); ?> > <?php if (has_post_thumbnail($post->ID)) { echo '<a class="post-thumbnail" href="' . get_permalink($post->ID) . '">'; // The URL to the image $data['url'] = wp_get_attachment_url(get_post_thumbnail_id($post->ID)); // Resize the image $image = Shoestrap_Image::image_resize($data); // Echo the image echo '<img src="' . $image['url'] . '" class="featured-post-image">'; echo '</a>'; } ?> <header class="entry-header"> <h3 class="featured entry-title"> <a href="<?php echo esc_url(get_permalink($post->ID)); ?> " rel="bookmark"><?php echo get_the_title($post->ID); ?> </a> </h3> </header><!-- .entry-header --> </article><!-- #post-## --> <?php } do_action('shoestrap_featured_posts_after'); wp_reset_postdata(); echo $ss_framework->close_container(); echo '</div>'; echo $ss_framework->clearfix(); }
/** * Image functions */ function shoestrap_image_resize($data) { _shoestrap_deprecated_function(__FUNCTION__, '3.2', 'Shoestrap_Image::image_resize()'); return Shoestrap_Image::image_resize($data); }