Exemplo n.º 1
0
                        $full_image = wp_get_attachment_image_src($attachment_new_id, 'full');
                        ?>
										<?php 
                        $attachment_data = wp_get_attachment_metadata($attachment_new_id);
                        ?>
										<?php 
                        if (!$full_image) {
                            ?>
											<?php 
                            $resized_image = array('url' => '');
                            ?>
										<?php 
                        } else {
                            ?>
											<?php 
                            $resized_image = Fusion_Image_Resizer::image_resize(array('width' => Avada()->layout->get_content_width(), 'height' => intval($full_image[2] * Avada()->layout->get_content_width() / $full_image[1]), 'url' => $full_image[0], 'crop' => false, 'retina' => true));
                            ?>
										<?php 
                        }
                        ?>
										<li>
											<?php 
                        if (Avada()->settings->get('status_lightbox') && Avada()->settings->get('status_lightbox_single')) {
                            ?>
												<a href="<?php 
                            echo $full_image[0];
                            ?>
" data-rel="iLightbox[gallery<?php 
                            the_ID();
                            ?>
]" title="<?php 
Exemplo n.º 2
0
 /**
  * Render the full markup of the first featured image, incl. image wrapper and rollover
  * @param  string  $post_id 					ID of the current post
  * @param  string  $post_featured_image_size 	Size of the featured image
  * @param  string  $post_permalink 				Permalink of current post
  * @param  boolean $display_post_title 			Set to yes to show post title on rollover
  * @param  boolean $display_post_categories 	Set to yes to show post categories on rollover 
  *
  * @return string Full HTML markup of the first featured image
  **/
 function avada_render_first_featured_image_markup($post_id, $post_featured_image_size = '', $post_permalink = '', $display_placeholder_image = FALSE, $display_woo_price = FALSE, $display_woo_buttons = FALSE, $display_post_categories = 'default', $display_post_title = 'default', $type = '', $gallery_id = '')
 {
     global $smof_data;
     $html = '<div class="fusion-image-wrapper" aria-haspopup="true">';
     // Get the featured image
     ob_start();
     // If there is a featured image, display it
     if (has_post_thumbnail($post_id)) {
         echo get_the_post_thumbnail($post_id, $post_featured_image_size);
         // If there is no featured image setup a placeholder
     } elseif ($display_placeholder_image) {
         /**
          * avada_placeholder_image hook
          *
          * @hooked avada_render_placeholder_image - 10 (outputs the HTML for the placeholder image)
          */
         do_action('avada_placeholder_image', $post_featured_image_size);
     }
     $featured_image = ob_get_clean();
     if ($type == 'related' && $post_featured_image_size == 'fixed' && get_post_thumbnail_id($post_id)) {
         $image = Fusion_Image_Resizer::image_resize(array('width' => '500', 'height' => '383', 'url' => wp_get_attachment_url(get_post_thumbnail_id($post_id)), 'path' => get_attached_file(get_post_thumbnail_id($post_id))));
         $featured_image = sprintf('<img src="%s" width="%s" height="%s" alt="%s" />', $image['url'], $image['width'], $image['height'], get_the_title($post_id));
     }
     // If rollovers are enabled, add one to the image container
     if ($smof_data['image_rollover']) {
         $html .= $featured_image;
         ob_start();
         /**
          * avada_rollover hook
          *
          * @hooked avada_render_rollover - 10 (outputs the HTML for the image rollover)
          */
         do_action('avada_rollover', $post_id, $post_permalink, $display_woo_price, $display_woo_buttons, $display_post_categories, $display_post_title, $gallery_id);
         $rollover = ob_get_clean();
         $html .= $rollover;
         // If rollovers are disabled, add post permalink to the featured image
     } else {
         $html .= sprintf('<a href="%s">%s</a>', $post_permalink, $featured_image);
     }
     $html .= '</div>';
     return $html;
 }
Exemplo n.º 3
0
    /**
     * Render the full markup of the first featured image, incl. image wrapper and rollover
     * @param  string  $post_id 					ID of the current post
     * @param  string  $post_featured_image_size 	Size of the featured image
     * @param  string  $post_permalink 				Permalink of current post
     * @param  boolean $display_post_title 			Set to yes to show post title on rollover
     * @param  boolean $display_post_categories 	Set to yes to show post categories on rollover
     * @param  boolean $display_post_categories 	Set to yes to show post categories on rollover
     * @param  string	$display_post_title 		Controls if the post title will be shown; "deafult": theme option setting; enable/disable otheriwse
     * @param  string	type 						Type of element the featured image is for. "Related" for related posts is the only type in use so far
     * @param  string	$gallery_id 				ID of a special gallery the rollover "zoom" link should be connected to for lightbox
     *
     * @return string Full HTML markup of the first featured image
     **/
    function avada_render_first_featured_image_markup($post_id, $post_featured_image_size = '', $post_permalink = '', $display_placeholder_image = FALSE, $display_woo_price = FALSE, $display_woo_buttons = FALSE, $display_post_categories = 'default', $display_post_title = 'default', $type = '', $gallery_id = '')
    {
        // Add a class for fixed image size, to restrict the image rollovers to the image width
        $image_size_class = '';
        if ($post_featured_image_size != 'full') {
            $image_size_class = ' fusion-image-size-fixed';
        }
        if (!has_post_thumbnail($post_id) && get_post_meta($post_id, 'pyre_video', true) || is_home() && $post_featured_image_size == 'blog-large') {
            $image_size_class = '';
        }
        $html = '<div class="fusion-image-wrapper' . $image_size_class . '" aria-haspopup="true">';
        // Get the featured image
        ob_start();
        // If there is a featured image, display it
        if (has_post_thumbnail($post_id)) {
            echo get_the_post_thumbnail($post_id, $post_featured_image_size);
            // Display a video if it is set
        } elseif (get_post_meta($post_id, 'pyre_video', true)) {
            ?>
				<div class="full-video">
					<?php 
            echo get_post_meta($post_id, 'pyre_video', true);
            ?>
				</div>
				<?php 
            // If there is no featured image setup a placeholder
        } elseif ($display_placeholder_image) {
            /**
             * avada_placeholder_image hook
             *
             * @hooked avada_render_placeholder_image - 10 (outputs the HTML for the placeholder image)
             */
            do_action('avada_placeholder_image', $post_featured_image_size);
        }
        $featured_image = ob_get_clean();
        if ($type == 'related' && $post_featured_image_size == 'fixed' && get_post_thumbnail_id($post_id)) {
            $image = Fusion_Image_Resizer::image_resize(array('width' => '500', 'height' => '383', 'url' => wp_get_attachment_url(get_post_thumbnail_id($post_id)), 'path' => get_attached_file(get_post_thumbnail_id($post_id))));
            $featured_image = sprintf('<img src="%s" width="%s" height="%s" alt="%s" />', $image['url'], $image['width'], $image['height'], get_the_title($post_id));
        }
        // If rollovers are enabled, add one to the image container
        if (Avada()->settings->get('image_rollover')) {
            $html .= $featured_image;
            ob_start();
            /**
             * avada_rollover hook
             *
             * @hooked avada_render_rollover - 10 (outputs the HTML for the image rollover)
             */
            do_action('avada_rollover', $post_id, $post_permalink, $display_woo_price, $display_woo_buttons, $display_post_categories, $display_post_title, $gallery_id);
            $rollover = ob_get_clean();
            $html .= $rollover;
            // If rollovers are disabled, add post permalink to the featured image
        } else {
            $html .= sprintf('<a href="%s">%s</a>', $post_permalink, $featured_image);
        }
        $html .= '</div>';
        return $html;
    }
Exemplo n.º 4
0
<?php

ob_start();
if ('related' == $type && 'fixed' == $post_featured_image_size && get_post_thumbnail_id($post_id)) {
    /**
     * Resize images for use as related posts
     */
    $image = Fusion_Image_Resizer::image_resize(array('width' => '500', 'height' => '383', 'url' => wp_get_attachment_url(get_post_thumbnail_id($post_id)), 'path' => get_attached_file(get_post_thumbnail_id($post_id))));
    $scrset = isset($image['retina_url']) && $image['retina_url'] ? ' srcset="' . $image['url'] . ' 1x, ' . $image['retina_url'] . ' 2x"' : '';
    ?>
	<img src="<?php 
    echo $image['url'];
    ?>
"<?php 
    echo $scrset;
    ?>
 width="<?php 
    echo $image['width'];
    ?>
" height="<?php 
    echo $image['height'];
    ?>
" alt="<?php 
    the_title_attribute('post=' . $post_id);
    ?>
" />

<?php 
} else {
    ?>