/var/www/(Del)hsihk.com/wp-content/themes/flatsome/inc/shortcodes/featured_items.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<?php

// [featured_items_slider]
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',
  ), 
$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'=> 'menu_order',
        ));
        while (
$wp_query->have_posts()) : $wp_query->the_post();
          
$link get_permalink(get_the_ID());
            
          if(
$lightbox == 'true'){
            
$link wp_get_attachment_image_srcget_post_thumbnail_idget_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_listget_the_ID(), 'featured_item_category'"",", " ) );?>
                    </p>
                     <div class="tx-div small show-next"></div>
                </div><!-- .ux-box-text-overlay -->
              </a>
           </div>
          </div>
          </li>


        
        <?php endwhile; 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;
}


// [featured_items_grid]
function ux_featured_items_grid($atts$content null) {
  
$sliderrandomid rand();
  
extract(shortcode_atts(array(
    
'items'  => '8',
        
'columns' => '4',
        
'cat' => '',
        
'style' => '1',
        
'height' => '',
        
'lightbox' => 'false',
  ), 
$atts));
  
ob_start();
  
?>
    <div class="ux-box-grid">
      <ul class="large-block-grid-<?php echo $columns?> small-block-grid-2">
        <?php
        
global $wp_query;
        
$wp_query = new WP_Query(array(
          
'post_type' => 'featured_item',
          
'posts_per_page' => $items,
          
'featured_item_category' => $cat,
          
'orderby'=> 'menu_order',
        ));



        while (
$wp_query->have_posts()) : $wp_query->the_post();
          
$link get_permalink(get_the_ID());
          
          if(
$lightbox == 'true'){
            
$link wp_get_attachment_image_srcget_post_thumbnail_idget_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 small-font uppercase">
                      <?php  echo strip_tags get_the_term_listget_the_ID(), 'featured_item_category'"",", " ) );?>
                    </p>
                    <div class="tx-div small show-next"></div>
                </div><!-- .ux-box-text-overlay -->
              </a>
           </div>
         </div>
          </li>
        
        <?php endwhile; wp_reset_query(); ?>
           
    </div><!-- .row -->
   
  <?php
  $content 
ob_get_contents();
  
ob_end_clean();
  return 
$content;
}

add_shortcode("featured_items_slider""ux_featured_items_slider");
add_shortcode("featured_items_grid""ux_featured_items_grid");