Ejemplo n.º 1
0
function ux_custom_products($atts, $content = null)
{
    $sliderrandomid = rand();
    extract(shortcode_atts(array("title" => '', 'products' => '8', 'cat' => '', 'orderby' => 'date', 'order' => 'desc', 'columns' => '4', 'infinitive' => 'false'), $atts));
    ob_start();
    ?>
    
    <?php 
    /**
     * Check if WooCommerce is active
     **/
    if (function_exists('wc_print_notices')) {
        ?>
    
		<?php 
        if ($title) {
            ?>
 
		<div class="row">
			<div class="large-12 columns">
				<h3 class="section-title"><span><?php 
            echo $title;
            ?>
</span></h3>
			</div>
		</div><!-- end .title -->
		<?php 
        }
        ?>

		<div class="row column-slider">
            <div id="slider_<?php 
        echo $sliderrandomid;
        ?>
" class="iosSlider" style="overflow:hidden;height:200px;min-height:200px;">
                <ul class="slider large-block-grid-<?php 
        echo $columns;
        ?>
 small-block-grid-2">
				  <?php 
        $args = array('product_cat' => $cat, 'post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $products, 'orderby' => $orderby, 'order' => $order);
        $products = new WP_Query($args);
        if ($products->have_posts()) {
            ?>
                                
                        <?php 
            while ($products->have_posts()) {
                $products->the_post();
                ?>
                    
                            <?php 
                woocommerce_get_template_part('content', 'product');
                ?>
                
                        <?php 
            }
            // end of the loop.
            ?>
                        
                    <?php 
        }
        wp_reset_query();
        ?>
                </ul>   <!-- .slider -->  
                  <div class="sliderControlls">
				        <div class="sliderNav small hide-for-small">
				       		 <a href="javascript:void(0)" class="nextSlide disabled prev_<?php 
        echo $sliderrandomid;
        ?>
"><span class="icon-angle-left"></span></a>
				       		 <a href="javascript:void(0)" class="prevSlide next_<?php 
        echo $sliderrandomid;
        ?>
"><span class="icon-angle-right"></span></a>
				        </div>
       			   </div><!-- .sliderControlls -->
       		 </div> <!-- .iOsslider -->
    </div><!-- .row .column-slider -->

    
    <?php 
    }
    ?>

    <?php 
    slider_script($sliderrandomid, $columns, $infinitive);
    ?>


	<?php 
    $content = ob_get_contents();
    ob_end_clean();
    return $content;
}
Ejemplo n.º 2
0
function ux_products($atts, $content = null, $tag)
{
    global $woocommerce;
    $sliderrandomid = rand();
    extract(shortcode_atts(array('title' => '', 'products' => '8', 'columns' => '4', 'orderby' => '', 'type' => 'slider', 'cat' => '', 'show' => '', 'tags' => '', 'ids' => '', 'infinitive' => 'false', 'auto_slide' => 'false', 'arrows' => 'true'), $atts));
    if ($tag == 'ux_bestseller_products') {
        if (!$orderby) {
            $atts['orderby'] = 'sales';
        }
    } else {
        if ($tag == 'ux_featured_products') {
            $atts['show'] = 'featured';
        } else {
            if ($tag == 'ux_sale_products') {
                $atts['show'] = 'onsale';
            } else {
                if ($tag == 'ux_custom_products') {
                } else {
                    if ($tag == 'product_lookbook') {
                        $type = 'lookbook';
                    } else {
                        if ($tag == 'products_pinterest_style') {
                            $type = 'masonry';
                            if ($products == '8') {
                                $atts['products'] = '999';
                                $columns = '3';
                            }
                        }
                    }
                }
            }
        }
    }
    if ($type == 'lookbook') {
        $infinitive = 'true';
    }
    ob_start();
    ?>
    
    <?php 
    /**
     * Check if WooCommerce is active
     **/
    if (function_exists('wc_print_notices')) {
        ?>
		<?php 
        if ($title) {
            ?>
 
		<div class="row">
			<div class="large-12 columns">
				<h3 class="section-title"><span><?php 
            echo $title;
            ?>
</span></h3>
			</div>
		</div><!-- end .title -->
		<?php 
        }
        ?>

	    <?php 
        if ($type !== 'lookbook') {
            ?>
<div class="row"><?php 
        }
        ?>
		
		<?php 
        if ($type == 'normal') {
            ?>
			<div class="large-12 columns"> 
			<ul class="large-block-grid-<?php 
            echo $columns;
            ?>
 small-block-grid-2"><?php 
        }
        ?>
        <?php 
        if ($type == 'lookbook') {
            ?>
        	<div id="slider_<?php 
            echo $sliderrandomid;
            ?>
" class="iosSlider lookbook-slider" style="overflow:hidden;height:350px;min-height:350px;">
            <ul class="slider large-block-grid-<?php 
            echo $columns;
            ?>
 small-block-grid-2">
        	<?php 
        }
        ?>
       	<?php 
        if ($type == 'masonry') {
            ?>
        	<div class="large-12 columns">
            <ul class="pinterest-style large-block-grid-<?php 
            echo $columns;
            ?>
 small-block-grid-2">
         	<?php 
        }
        ?>
        <?php 
        if ($type == 'slider') {
            ?>
 
        	<div id="slider_<?php 
            echo $sliderrandomid;
            ?>
" class="iosSlider column-slider" style="overflow:hidden;height:250px;min-height:250px;">
            <ul class="slider large-block-grid-<?php 
            echo $columns;
            ?>
 small-block-grid-2">
        	<?php 
        }
        ?>
			<?php 
        $r = ux_list_products($atts);
        if ($r->have_posts()) {
            ?>
                        
                <?php 
            while ($r->have_posts()) {
                $r->the_post();
                ?>

                <?php 
                if ($type == 'lookbook') {
                    woocommerce_get_template_part('content', 'product-lookbook');
                } else {
                    if ($type == 'masonry') {
                        woocommerce_get_template_part('content', 'product-pinterest-style');
                    } else {
                        woocommerce_get_template_part('content', 'product');
                    }
                }
                ?>
                <?php 
            }
            // end of the loop.
            ?>
                
            <?php 
        }
        wp_reset_query();
        ?>
          </ul>   <!-- .products -->  
           <?php 
        if ($type == 'slider' || $type == 'lookbook' || $arrows == 'true') {
            ?>
 
	            		<div class="sliderControlls <?php 
            if ($type == 'lookbook') {
                ?>
dark<?php 
            }
            ?>
">
					        <div class="sliderNav <?php 
            if ($type !== 'lookbook') {
                ?>
small<?php 
            }
            ?>
 hide-for-small">
					       		 <a href="javascript:void(0)" class="nextSlide disabled prev_<?php 
            echo $sliderrandomid;
            ?>
"><span class="icon-angle-left"></span></a>
					       		 <a href="javascript:void(0)" class="prevSlide next_<?php 
            echo $sliderrandomid;
            ?>
"><span class="icon-angle-right"></span></a>
					        </div>
	       			   </div><!-- .sliderControlls -->
       		 <?php 
            // Run slider script
            slider_script($sliderrandomid, $columns, $infinitive);
        }
        ?>
		</div>
	<?php 
        if ($type !== 'lookbook') {
            ?>
</div><!-- .row --><?php 
        }
        ?>

   	<?php 
        if ($type == 'masonry') {
            ?>
 
	 <script>
		/* PACKERY GRID */
		jQuery(document).ready(function ($) {
		    var $container = $(".pinterest-style");
		    // initialize
		    $container.packery({
		      itemSelector: "li",
		      gutter: 0
		    });

		    imagesLoaded( document.querySelector('.pinterest-style'), function( instance, container ) {
	  			$container.packery('layout');
			});
		 });
	</script>
    <?php 
        }
        ?>

    <?php 
    }
    // if woocommerce is active
    ?>

	<?php 
    $content = ob_get_contents();
    ob_end_clean();
    return $content;
}
Ejemplo n.º 3
0
function ux_featured_items_slider($atts, $content = null)
{
    $sliderrandomid = rand();
    extract(shortcode_atts(array('items' => '8', 'columns' => '4', 'cat' => '', 'style' => '1', 'height' => '', 'infinitive' => 'false', 'lightbox' => 'false', 'order' => 'menu_order'), $atts));
    ob_start();
    ?>
    
    
    <?php 
    slider_script($sliderrandomid, $columns, $infinitive);
    ?>


    <div class="<?php 
    if ($style == '1') {
        echo 'row';
    }
    ?>
  <?php 
    if ($style == '2') {
        echo 'slider-center-arrows';
    }
    ?>
 column-slider">
            <div id="slider_<?php 
    echo $sliderrandomid;
    ?>
" class="iosSlider" style="overflow:hidden;height:100px;min-height:100px;">
                <ul class="slider large-block-grid-<?php 
    echo $columns;
    ?>
 small-block-grid-2">
         <?php 
    global $wp_query;
    $wp_query = new WP_Query(array('post_type' => 'featured_item', 'featured_item_category' => $cat, 'posts_per_page' => $items, 'orderby' => $order));
    while ($wp_query->have_posts()) {
        $wp_query->the_post();
        $link = get_permalink(get_the_ID());
        if ($lightbox == 'true') {
            $link = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'single-post-thumbnail');
            $link = $link[0];
        }
        ?>
          

          <li class="ux-box text-center featured-item <?php 
        if ($style == '1') {
            echo 'ux-text-bounce';
        }
        ?>
 <?php 
        if ($style == '2') {
            echo 'ux-text-overlay dark';
        }
        ?>
 ">
            <div class="inner">
             <div class="inner-wrap">
              <a href="<?php 
        echo $link;
        ?>
" title="<?php 
        the_title();
        ?>
">
                <div class="ux-box-image" style="<?php 
        if ($height) {
            echo 'max-height:' . $height;
        }
        ?>
">
                      <?php 
        the_post_thumbnail('thumbnail');
        ?>
                </div><!-- .ux-box-image -->
                <div class="ux-box-text">
                    <h4 class="uppercase"><?php 
        the_title();
        ?>
</h4>
                    <p class="show-next smaller-font uppercase">
                      <?php 
        echo strip_tags(get_the_term_list(get_the_ID(), 'featured_item_category', "", ", "));
        ?>
                    </p>
                     <div class="tx-div small show-next"></div>
                </div><!-- .ux-box-text-overlay -->
              </a>
           </div>
          </div>
          </li>


        
        <?php 
    }
    wp_reset_query();
    ?>
                </ul>   <!-- .slider -->  
                  <div class="sliderControlls">
                <div class="sliderNav small hide-for-small">
                   <a href="javascript:void(0)" class="nextSlide disabled prev_<?php 
    echo $sliderrandomid;
    ?>
"><span class="icon-angle-left"></span></a>
                   <a href="javascript:void(0)" class="prevSlide next_<?php 
    echo $sliderrandomid;
    ?>
"><span class="icon-angle-right"></span></a>
                </div>
               </div><!-- .sliderControlls -->
           </div> <!-- .iOsslider -->
    </div><!-- .row .column-slider -->

   
  <?php 
    $content = ob_get_contents();
    ob_end_clean();
    return $content;
}
Ejemplo n.º 4
0
function ux_product_categories($atts, $content = null)
{
    $sliderrandomid = rand();
    extract(shortcode_atts(array('number' => null, 'title' => '', 'orderby' => 'name', 'order' => 'ASC', 'type' => 'slider', 'columns' => '4', 'hide_empty' => 1, 'parent' => '', 'infinitive' => 'false', 'style' => 'text-badge', 'offset' => ''), $atts));
    if (isset($atts['ids'])) {
        $ids = explode(',', $atts['ids']);
        $ids = array_map('trim', $ids);
    } else {
        $ids = array();
    }
    $hide_empty = $hide_empty == true || $hide_empty == 1 ? 1 : 0;
    // get terms and workaround WP bug with parents/pad counts
    $args = array('orderby' => $orderby, 'order' => $order, 'hide_empty' => $hide_empty, 'include' => $ids, 'pad_counts' => true, 'child_of' => 0, 'offset' => $offset);
    $product_categories = get_terms('product_cat', $args);
    if ($parent !== "") {
        $product_categories = wp_list_filter($product_categories, array('parent' => $parent));
    }
    if ($number) {
        $product_categories = array_slice($product_categories, 0, $number);
    }
    $woocommerce_loop['columns'] = $columns;
    ob_start();
    ?>
    
    <?php 
    /**
     * Check if WooCommerce is active
     **/
    if (function_exists('wc_print_notices')) {
        ?>
    

    <?php 
        if ($type == 'slider') {
            slider_script($sliderrandomid, $columns, $infinitive);
        }
        ?>

    <?php 
        if ($title) {
            ?>
 
    <div class="row">
      <div class="large-12 columns">
        <h3 class="section-title"><span><?php 
            echo $title;
            ?>
</span></h3>
      </div>
    </div><!-- end .title -->
    <?php 
        }
        ?>

   <?php 
        if ($type == 'slider') {
            ?>
   <div class="row column-slider slider-center-arrows">
            <div id="slider_<?php 
            echo $sliderrandomid;
            ?>
" class="iosSlider" style="overflow:hidden;height:200px;min-height:200px;">
   <?php 
        }
        ?>
                <ul class=" <?php 
        if ($type == 'slider') {
            ?>
slider<?php 
        }
        ?>
 large-block-grid-<?php 
        echo $columns;
        ?>
 small-block-grid-2">
          <?php 
        if ($product_categories) {
            foreach ($product_categories as $category) {
                woocommerce_get_template('content-product_cat.php', array('category' => $category, 'style' => $style));
            }
        }
        woocommerce_reset_loop();
        ?>
                </ul>   <!-- .slider -->  
    <?php 
        if ($type == 'slider') {
            ?>
                  <div class="sliderControlls">
                <div class="sliderNav small hide-for-small">
                   <a href="javascript:void(0)" class="nextSlide disabled prev_<?php 
            echo $sliderrandomid;
            ?>
"><span class="icon-angle-left"></span></a>
                   <a href="javascript:void(0)" class="prevSlide next_<?php 
            echo $sliderrandomid;
            ?>
"><span class="icon-angle-right"></span></a>
                </div>
               </div><!-- .sliderControlls -->
           </div> <!-- .iOsslider -->
    </div><!-- .row .column-slider -->
    <?php 
        }
        ?>

    
    <?php 
    }
    ?>

  <?php 
    $content = ob_get_contents();
    ob_end_clean();
    return $content;
}