function eightstore_lite_homepage_slider_content()
{
    $display_slider = get_theme_mod('display_slider', '1') ? get_theme_mod('display_slider', '1') : "1";
    $display_captions = get_theme_mod('display_captions', '1') ? get_theme_mod('display_captions', '1') : "1";
    if ($display_slider == "1") {
        ?>
	<section id="home-slider">
		<div class="es-slider">
			<?php 
        $slider_category = get_theme_mod('slider_setting_category');
        if (!empty($slider_category)) {
            $loop = new WP_Query(array('cat' => $slider_category, 'posts_per_page' => -1));
            if ($loop->have_posts()) {
                while ($loop->have_posts()) {
                    $loop->the_post();
                    $image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'full', false);
                    ?>
				<div class="slides">
					<img src="<?php 
                    echo esc_url($image[0]);
                    ?>
" alt="<?php 
                    the_title_attribute();
                    ?>
" />
					<?php 
                    $display_captions = get_theme_mod('display_captions', '1');
                    if ($display_captions != 0) {
                        $display_captions = 1;
                    }
                    if ($display_captions == 1) {
                        ?>
					<div class="banner-caption">
						<div class="caption-wrapper">
							<div class="caption-title"><?php 
                        eightstore_lite_get_title(get_the_title());
                        ?>
</div>
							<div class="caption-desc"><?php 
                        echo eightstore_lite_excerpt(get_the_content(), 100, '...', true, true);
                        ?>
</div>
						</div>
					</div>
					<?php 
                    }
                    ?>
				</div>
				<?php 
                }
            }
            ?>
			<?php 
        }
        ?>
		</div>
		<?php 
    }
    ?>
	</section>
	<?php 
}
Esempio n. 2
0
    /**
     * Front-end display of widget.
     *
     * @see WP_Widget::widget()
     *
     * @param array $args     Widget arguments.
     * @param array $instance Saved values from database.
     */
    public function widget($args, $instance)
    {
        extract($args);
        $promo_title = $instance['promo_title'];
        $promo = $instance['promo_image'];
        if (isset($instance['promo_btn_text'])) {
            $promo_btn_text = $instance['promo_btn_text'];
        } else {
            $promo_btn_text = "";
        }
        $promo_desc = $instance['promo_desc'];
        $promo_link = $instance['promo_link'];
        echo $before_widget;
        ?>
        <div class="promo-widget-wrap">
            <a href="<?php 
        echo $promo_link;
        ?>
 ">
                <div class="promo-image">
                    <?php 
        if (!empty($promo)) {
            ?>
                    <img src = "<?php 
            echo $promo;
            ?>
" />
                    <?php 
        }
        ?>
                </div>
                <div class="caption">
                    <?php 
        if (!empty($promo_title)) {
            ?>
                    <h4 class="widget-title"><?php 
            echo eightstore_lite_get_title($promo_title);
            ?>
</h4>
                    <?php 
        }
        ?>

                    <?php 
        if (!empty($promo_desc)) {
            ?>
                    <div class="desc"><?php 
            echo $promo_desc;
            ?>
</div>
                    <?php 
        }
        ?>

                    <?php 
        if (!empty($promo_btn_text)) {
            ?>
                    <div class="promo-btn"><?php 
            echo $promo_btn_text;
            ?>
</div>
                    <?php 
        }
        ?>
 
                </div>
            </a>
        </div>        
        <?php 
        echo $after_widget;
    }