Ejemplo n.º 1
0
    function avada_render_rollover($post_id, $post_permalink = '', $display_woo_price = false, $display_woo_buttons = false, $display_post_categories = 'default', $display_post_title = 'default', $gallery_id = '')
    {
        // Retrieve the permalink if it is not set
        if (!$post_permalink) {
            $post_permalink = get_permalink($post_id);
        }
        // Check if theme options are used as base or if there is an override for post categories
        if ('enable' == $display_post_categories) {
            $display_post_categories = true;
        } elseif ('disable' == $display_post_categories) {
            $display_post_categories = false;
        } else {
            $display_post_categories = !Avada()->settings->get('cats_image_rollover');
        }
        // Check if theme options are used as base or if there is an override for post title
        if ('enable' == $display_post_title) {
            $display_post_title = true;
        } elseif ('disable' == $display_post_title) {
            $display_post_title = false;
        } else {
            $display_post_title = !Avada()->settings->get('title_image_rollover');
        }
        // Set the link on the link icon to a custom url if set in page options
        $icon_permalink = fusion_get_page_option('link_icon_url', $post_id) != null ? fusion_get_page_option('link_icon_url', $post_id) : $post_permalink;
        if ('' == fusion_get_page_option('image_rollover_icons', $post_id) || 'default' == fusion_get_page_option('image_rollover_icons', $post_id)) {
            if (!Avada()->settings->get('link_image_rollover') && !Avada()->settings->get('zoom_image_rollover')) {
                // link + zoom
                $image_rollover_icons = 'linkzoom';
            } elseif (!Avada()->settings->get('link_image_rollover') && Avada()->settings->get('zoom_image_rollover')) {
                // link
                $image_rollover_icons = 'link';
            } elseif (Avada()->settings->get('link_image_rollover') && !Avada()->settings->get('zoom_image_rollover')) {
                // zoom
                $image_rollover_icons = 'zoom';
            } elseif (Avada()->settings->get('link_image_rollover') && Avada()->settings->get('zoom_image_rollover')) {
                // link
                $image_rollover_icons = 'no';
            } else {
                $image_rollover_icons = 'linkzoom';
            }
        } else {
            $image_rollover_icons = fusion_get_page_option('image_rollover_icons', $post_id);
        }
        // Set the link target to blank if the option is set
        $link_target = 'yes' == fusion_get_page_option('link_icon_target', $post_id) || 'yes' == fusion_get_page_option('post_links_target', $post_id) ? ' target="_blank"' : '';
        ?>
		<div class="fusion-rollover">
			<div class="fusion-rollover-content">

				<?php 
        if ('no' != $image_rollover_icons && 'product' != get_post_type($post_id)) {
            // Check if rollover icons should be displayed
            ?>

					<?php 
            if ('zoom' != $image_rollover_icons) {
                // If set, render the rollover link icon
                ?>
						<a class="fusion-rollover-link" href="<?php 
                echo $icon_permalink;
                ?>
"<?php 
                echo $link_target;
                ?>
>Permalink</a>
					<?php 
            }
            ?>

					<?php 
            if ('link' != $image_rollover_icons) {
                // If set, render the rollover zoom icon
                ?>
						<?php 
                // Get the image data
                $full_image = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), 'full');
                if (!is_array($full_image)) {
                    $full_image = array();
                    $full_image[0] = '';
                }
                // If a video url is set in the post options, use it inside the lightbox
                if (fusion_get_page_option('video_url', $post_id)) {
                    $full_image[0] = fusion_get_page_option('video_url', $post_id);
                }
                ?>

						<?php 
                if ('linkzoom' == $image_rollover_icons || '' === $image_rollover_icons) {
                    // If both icons will be shown, add a separator
                    ?>
							<div class="fusion-rollover-sep"></div>
						<?php 
                }
                ?>

						<?php 
                if ($full_image[0]) {
                    // Render the rollover zoom icon if we have an image
                    ?>
							<?php 
                    // Only show images of the clicked post
                    if ('individual' == Avada()->settings->get('lightbox_behavior')) {
                        $lightbox_content = avada_featured_images_lightbox($post_id);
                        $data_rel = sprintf('iLightbox[gallery%s]', $post_id);
                        // Show the first image of every post on the archive page
                    } else {
                        $lightbox_content = '';
                        $data_rel = sprintf('iLightbox[gallery%s]', $gallery_id);
                    }
                    ?>
							<a class="fusion-rollover-gallery" href="<?php 
                    echo $full_image[0];
                    ?>
" data-id="<?php 
                    echo $post_id;
                    ?>
" data-rel="<?php 
                    echo $data_rel;
                    ?>
" data-title="<?php 
                    echo get_post_field('post_title', get_post_thumbnail_id($post_id));
                    ?>
" data-caption="<?php 
                    echo get_post_field('post_excerpt', get_post_thumbnail_id($post_id));
                    ?>
">Gallery</a><?php 
                    echo $lightbox_content;
                    ?>
						<?php 
                }
                ?>
					<?php 
            }
            ?>
				<?php 
        }
        ?>

				<?php 
        if ($display_post_title) {
            // Check if we should render the post title on the rollover
            ?>
					<h4 class="fusion-rollover-title"><a href="<?php 
            echo $icon_permalink;
            ?>
"<?php 
            echo $link_target;
            ?>
><?php 
            echo get_the_title($post_id);
            ?>
</a></h4>
				<?php 
        }
        ?>

				<?php 
        // Check if we should render the post categories on the rollover
        if ($display_post_categories) {
            // Determine the correct taxonomy
            $post_taxonomy = '';
            if ('post' == get_post_type($post_id)) {
                $post_taxonomy = 'category';
            } elseif ('avada_portfolio' == get_post_type($post_id)) {
                $post_taxonomy = 'portfolio_category';
            } elseif ('product' == get_post_type($post_id)) {
                $post_taxonomy = 'product_cat';
            }
            echo get_the_term_list($post_id, $post_taxonomy, '<div class="fusion-rollover-categories">', ', ', '</div>');
        }
        ?>

				<?php 
        if ($display_woo_price) {
            // Check if we should render the woo product price
            ?>
					<?php 
            woocommerce_get_template('loop/price.php');
            ?>
				<?php 
        }
        ?>

				<?php 
        if ($display_woo_buttons) {
            // Check if we should render the woo "add to cart" and "details" buttons
            ?>
					<div class="fusion-product-buttons">
						<?php 
            woocommerce_get_template('loop/add-to-cart.php');
            ?>
						<span class="fusion-rollover-linebreak"></span>
						<a class="fusion-show-details-button" href="<?php 
            echo post_permalink();
            ?>
"><?php 
            _e('Details', 'Avada');
            ?>
</a>
					</div>
				<?php 
        }
        ?>
			</div>
		</div>
		<?php 
    }
Ejemplo n.º 2
0
        ?>

				<?php 
        /**
         * Render the rollover zoom icon if we have an image
         */
        ?>
				<?php 
        if ($full_image[0]) {
            ?>
					<?php 
            /**
             * Only show images of the clicked post
             * Otherwise, show the first image of every post on the archive page
             */
            $lightbox_content = 'individual' == Avada()->settings->get('lightbox_behavior') ? avada_featured_images_lightbox($post_id) : '';
            $data_rel = 'individual' == Avada()->settings->get('lightbox_behavior') ? 'iLightbox[gallery' . $post_id . ']' : 'iLightbox[gallery' . $gallery_id . ']';
            ?>
					<a class="fusion-rollover-gallery" href="<?php 
            echo $full_image[0];
            ?>
" data-id="<?php 
            echo $post_id;
            ?>
" data-rel="<?php 
            echo $data_rel;
            ?>
" data-title="<?php 
            echo get_post_field('post_title', get_post_thumbnail_id($post_id));
            ?>
" data-caption="<?php 
Ejemplo n.º 3
0
 function avada_render_rollover($post_id, $post_permalink = '', $display_woo_price = FALSE, $display_woo_buttons = FALSE, $display_post_categories = 'default', $display_post_title = 'default', $gallery_id = '')
 {
     global $smof_data;
     // Retrieve the permalink if it is not set
     if (!$post_permalink) {
         $post_permalink = get_permalink($post_id);
     }
     // Check if theme options are used as base or if there is an override for post categories
     if ($display_post_categories == 'enable') {
         $display_post_categories = TRUE;
     } elseif ($display_post_categories == 'disable') {
         $display_post_categories = FALSE;
     } else {
         $display_post_categories = !$smof_data['cats_image_rollover'];
     }
     // Check if theme options are used as base or if there is an override for post title
     if ($display_post_title == 'enable') {
         $display_post_title = TRUE;
     } elseif ($display_post_title == 'disable') {
         $display_post_title = FALSE;
     } else {
         $display_post_title = !$smof_data['title_image_rollover'];
     }
     // Set the link on the link icon to a custom url if set in page options
     if (fusion_get_page_option('link_icon_url', $post_id) != NULL) {
         $icon_permalink = fusion_get_page_option('link_icon_url', $post_id);
     } else {
         $icon_permalink = $post_permalink;
     }
     if (fusion_get_page_option('image_rollover_icons', $post_id) == '' || fusion_get_page_option('image_rollover_icons', $post_id) == 'default') {
         if (!$smof_data['link_image_rollover'] && !$smof_data['zoom_image_rollover']) {
             // link + zoom
             $image_rollover_icons = 'linkzoom';
         } elseif (!$smof_data['link_image_rollover'] && $smof_data['zoom_image_rollover']) {
             // link
             $image_rollover_icons = 'link';
         } elseif ($smof_data['link_image_rollover'] && !$smof_data['zoom_image_rollover']) {
             // zoom
             $image_rollover_icons = 'zoom';
         } elseif ($smof_data['link_image_rollover'] && $smof_data['zoom_image_rollover']) {
             // link
             $image_rollover_icons = 'no';
         } else {
             $image_rollover_icons = 'linkzoom';
         }
     } else {
         $image_rollover_icons = fusion_get_page_option('image_rollover_icons', $post_id);
     }
     // Set the link target to blank if the option is set
     $link_target = '';
     if (fusion_get_page_option('link_icon_target', $post_id) == 'yes' || fusion_get_page_option('post_links_target', $post_id) == 'yes') {
         $link_target = ' target="_blank"';
     }
     echo '<div class="fusion-rollover">';
     echo '<div class="fusion-rollover-content">';
     // Check if rollover icons should be displayed
     if ($image_rollover_icons != 'no' && get_post_type($post_id) != 'product') {
         // If set, render the rollover link icon
         if ($image_rollover_icons != 'zoom') {
             echo sprintf('<a class="fusion-rollover-link" href="%s"%s>Permalink</a>', $icon_permalink, $link_target);
         }
         // If set, render the rollover zoom icon
         if ($image_rollover_icons != 'link') {
             // Get the image data
             $full_image = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), 'full');
             if (!is_array($full_image)) {
                 $full_image = array();
                 $full_image[0] = '';
             }
             // If a video url is set in the post options, use it inside the lightbox
             if (fusion_get_page_option('video_url', $post_id)) {
                 $full_image[0] = fusion_get_page_option('video_url', $post_id);
             }
             // If both icons will be shown, add a separator
             if ($image_rollover_icons == 'linkzoom' || $image_rollover_icons === '') {
                 echo '<div class="fusion-rollover-sep"></div>';
             }
             // Render the rollover zoom icon if we have an image
             if ($full_image[0]) {
                 // Only show images of the clicked post
                 if ($smof_data['lightbox_behavior'] == "individual") {
                     $lightbox_content = avada_featured_images_lightbox($post_id);
                     $data_rel = sprintf('iLightbox[gallery%s]', $post_id);
                     // Show the first image of every post on the archive page
                 } else {
                     $lightbox_content = '';
                     $data_rel = sprintf('iLightbox[gallery%s]', $gallery_id);
                 }
                 echo sprintf('<a class="fusion-rollover-gallery" href="%s" data-rel="%s" data-title="%s" data-caption="%s">Gallery</a>%s', $full_image[0], $data_rel, get_post_field('post_title', get_post_thumbnail_id($post_id)), get_post_field('post_excerpt', get_post_thumbnail_id($post_id)), $lightbox_content);
             }
         }
     }
     // Check if we should render the post title on the rollover
     if ($display_post_title) {
         echo sprintf('<h4 class="fusion-rollover-title"><a href="%s"%s>%s</a></h4>', $icon_permalink, $link_target, get_the_title($post_id));
     }
     // Check if we should render the post categories on the rollover
     if ($display_post_categories) {
         // Determine the correct taxonomy
         if (get_post_type($post_id) == 'post') {
             $post_taxonomy = 'category';
         } elseif (get_post_type($post_id) == 'avada_portfolio') {
             $post_taxonomy = 'portfolio_category';
         } elseif (get_post_type($post_id) == 'product') {
             $post_taxonomy = 'product_cat';
         }
         echo get_the_term_list($post_id, $post_taxonomy, '<div class="fusion-rollover-categories">', ', ', '</div>');
     }
     // Check if we should render the woo product price
     if ($display_woo_price) {
         woocommerce_get_template('loop/price.php');
     }
     // Check if we should render the woo "add to cart" and "details" buttons
     if ($display_woo_buttons) {
         echo '<div class="fusion-product-buttons">';
         woocommerce_get_template('loop/add-to-cart.php');
         echo '<span class="fusion-rollover-linebreak"></span>';
         echo sprintf('<a class="fusion-show-details-button" href="%s">%s</a>', $post_permalink, __('Details', 'Avada'));
         echo '</div>';
     }
     echo '</div>';
     echo '</div>';
 }
    function avada_render_rollover($post_id, $post_permalink = '', $display_woo_price = false, $display_woo_buttons = false, $display_post_categories = 'default', $display_post_title = 'default', $gallery_id = '', $display_woo_rating = false)
    {
        global $product, $woocommerce;
        // Retrieve the permalink if it is not set
        if (!$post_permalink) {
            $post_permalink = get_permalink($post_id);
        }
        // Check if theme options are used as base or if there is an override for post categories
        if ('enable' == $display_post_categories) {
            $display_post_categories = true;
        } elseif ('disable' == $display_post_categories) {
            $display_post_categories = false;
        } else {
            $display_post_categories = !Avada()->settings->get('cats_image_rollover');
        }
        // Check if theme options are used as base or if there is an override for post title
        if ('enable' == $display_post_title) {
            $display_post_title = true;
        } elseif ('disable' == $display_post_title) {
            $display_post_title = false;
        } else {
            $display_post_title = !Avada()->settings->get('title_image_rollover');
        }
        // Set the link on the link icon to a custom url if set in page options
        $icon_permalink = fusion_get_page_option('link_icon_url', $post_id) != null ? fusion_get_page_option('link_icon_url', $post_id) : $post_permalink;
        if ('' == fusion_get_page_option('image_rollover_icons', $post_id) || 'default' == fusion_get_page_option('image_rollover_icons', $post_id)) {
            if (!Avada()->settings->get('link_image_rollover') && !Avada()->settings->get('zoom_image_rollover')) {
                // link + zoom
                $image_rollover_icons = 'linkzoom';
            } elseif (!Avada()->settings->get('link_image_rollover') && Avada()->settings->get('zoom_image_rollover')) {
                // link
                $image_rollover_icons = 'link';
            } elseif (Avada()->settings->get('link_image_rollover') && !Avada()->settings->get('zoom_image_rollover')) {
                // zoom
                $image_rollover_icons = 'zoom';
            } elseif (Avada()->settings->get('link_image_rollover') && Avada()->settings->get('zoom_image_rollover')) {
                // link
                $image_rollover_icons = 'no';
            } else {
                $image_rollover_icons = 'linkzoom';
            }
        } else {
            $image_rollover_icons = fusion_get_page_option('image_rollover_icons', $post_id);
        }
        // Set the link target to blank if the option is set
        if ('yes' == fusion_get_page_option('link_icon_target', $post_id) || 'yes' == fusion_get_page_option('post_links_target', $post_id) || 'avada_portfolio' == get_post_type() && Avada()->settings->get('portfolio_link_icon_target') && 'default' == fusion_get_page_option('link_icon_target', $post_id)) {
            $link_target = ' target="_blank"';
        } else {
            $link_target = '';
        }
        ?>
		<div class="fusion-rollover">
			<div class="fusion-rollover-content">

				<?php 
        if ('no' != $image_rollover_icons && 'product' != get_post_type($post_id)) {
            // Check if rollover icons should be displayed
            ?>

					<?php 
            if ('zoom' != $image_rollover_icons) {
                // If set, render the rollover link icon
                ?>
						<a class="fusion-rollover-link" href="<?php 
                echo $icon_permalink;
                ?>
"<?php 
                echo $link_target;
                ?>
>Permalink</a>
					<?php 
            }
            ?>

					<?php 
            if ('link' != $image_rollover_icons) {
                // If set, render the rollover zoom icon
                ?>
						<?php 
                // Get the image data
                $full_image = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), 'full');
                if (!is_array($full_image)) {
                    $full_image = array();
                    $full_image[0] = '';
                }
                // If a video url is set in the post options, use it inside the lightbox
                if (fusion_get_page_option('video_url', $post_id)) {
                    $full_image[0] = fusion_get_page_option('video_url', $post_id);
                }
                ?>

						<?php 
                if ('linkzoom' == $image_rollover_icons || '' === $image_rollover_icons) {
                    // If both icons will be shown, add a separator
                    ?>
							<div class="fusion-rollover-sep"></div>
						<?php 
                }
                ?>

						<?php 
                if ($full_image[0]) {
                    // Render the rollover zoom icon if we have an image
                    ?>
							<?php 
                    // Only show images of the clicked post
                    if ('individual' == Avada()->settings->get('lightbox_behavior')) {
                        $lightbox_content = avada_featured_images_lightbox($post_id);
                        $data_rel = sprintf('iLightbox[gallery%s]', $post_id);
                        // Show the first image of every post on the archive page
                    } else {
                        $lightbox_content = '';
                        $data_rel = sprintf('iLightbox[gallery%s]', $gallery_id);
                    }
                    ?>
							<a class="fusion-rollover-gallery" href="<?php 
                    echo $full_image[0];
                    ?>
" data-id="<?php 
                    echo $post_id;
                    ?>
" data-rel="<?php 
                    echo $data_rel;
                    ?>
" data-title="<?php 
                    echo get_post_field('post_title', get_post_thumbnail_id($post_id));
                    ?>
" data-caption="<?php 
                    echo get_post_field('post_excerpt', get_post_thumbnail_id($post_id));
                    ?>
">Gallery</a><?php 
                    echo $lightbox_content;
                    ?>
						<?php 
                }
                ?>
					<?php 
            }
            ?>
				<?php 
        }
        ?>

				<?php 
        if ($display_post_title) {
            // Check if we should render the post title on the rollover
            ?>
					<h4 class="fusion-rollover-title"><a href="<?php 
            echo $icon_permalink;
            ?>
"<?php 
            echo $link_target;
            ?>
><?php 
            echo get_the_title($post_id);
            ?>
</a></h4>
				<?php 
        }
        ?>

				<?php 
        // Check if we should render the post categories on the rollover
        if ($display_post_categories) {
            // Determine the correct taxonomy
            $post_taxonomy = '';
            if ('post' == get_post_type($post_id)) {
                $post_taxonomy = 'category';
            } elseif ('avada_portfolio' == get_post_type($post_id)) {
                $post_taxonomy = 'portfolio_category';
            } elseif ('product' == get_post_type($post_id)) {
                $post_taxonomy = 'product_cat';
            }
            echo get_the_term_list($post_id, $post_taxonomy, '<div class="fusion-rollover-categories">', ', ', '</div>');
        }
        ?>

				<?php 
        if (class_exists('WooCommerce') && $woocommerce->cart) {
            $items_in_cart = array();
            if ($woocommerce->cart->get_cart() && is_array($woocommerce->cart->get_cart())) {
                foreach ($woocommerce->cart->get_cart() as $cart) {
                    $items_in_cart[] = $cart['product_id'];
                }
            }
            $id = get_the_ID();
            $in_cart = in_array($id, $items_in_cart);
            if ($in_cart) {
                echo '<span class="cart-loading">' . '<a href="' . $woocommerce->cart->get_cart_url() . '">' . '<i class="fusion-icon-check-square-o"></i><span class="view-cart">' . __('View Cart', 'Avada') . '</span></a></span>';
            } else {
                echo '<span class="cart-loading">' . '<a href="' . $woocommerce->cart->get_cart_url() . '">' . '<i class="fusion-icon-spinner"></i><span class="view-cart">' . __('View Cart', 'Avada') . '</span></a></span>';
            }
        }
        ?>

				<?php 
        if ($display_woo_rating) {
            // Check if we should render the woo product price
            ?>
					<?php 
            woocommerce_get_template('loop/rating.php');
            ?>
				<?php 
        }
        ?>

				<?php 
        if ($display_woo_price) {
            // Check if we should render the woo product price
            ?>
					<?php 
            woocommerce_get_template('loop/price.php');
            ?>
				<?php 
        }
        ?>

				<?php 
        if ($display_woo_buttons) {
            // Check if we should render the woo "add to cart" and "details" buttons
            ?>
					<div class="fusion-product-buttons">
						<?php 
            /**
             * avada_woocommerce_buttons_on_rollover hook.
             *
             * @hooked FusionTemplateWoo::avada_woocommerce_template_loop_add_to_cart - 10 (outputs add to cart button)
             * @hooked FusionTemplateWoo::avada_woocommerce_rollover_buttons_linebreak - 15 (outputs line break for the buttons, needed for clean version)
             * @hooked FusionTemplateWoo::show_details_button - 20 (outputs the show details button)
             */
            do_action('avada_woocommerce_buttons_on_rollover');
            ?>
					</div>
				<?php 
        }
        ?>
			</div>
		</div>
		<?php 
    }