Facebook
From Botched Tapir, 1 Year ago, written in Plain Text.
This paste is a reply to Untitled from imahmoodzz - view diff
Embed
Download Paste or View Raw
Hits: 137
  1. CSF::createWidget('csf_widget_carousel_3', array(
  2.     'title'       => 'ویجت کلاکت فیلم: ویجت کروسل مطالب دسته custom',
  3.     'classname'   => 'csf-widget-classname',
  4.     'description' => 'ویجت اختصاصی کلاکت فیلم برای نمایش کروسل مطالب دسته',
  5.     'fields'      => array(
  6.  
  7.       array(
  8.         'id'      => 'title',
  9.         'type'    => 'text',
  10.         'title'   => 'عنوان ویجت',
  11.       ),
  12.       array(
  13.         'id'      => 'icon',
  14.         'type'    => 'text',
  15.         'subtitle' => 'از FontAwesome استفاده شود',
  16.         'placeholder' => 'مثلا: film',
  17.         'title'   => 'آیکون ویجت',
  18.       ),
  19.       array(
  20.         'id'      => 'count',
  21.         'type'    => 'text',
  22.         'title'   => 'تعداد مطالب',
  23.       ),
  24.       array(
  25.         'id'      => 'archive',
  26.         'type'    => 'switcher',
  27.         'title' => 'نمایش دکمه آرشیو',
  28.         'text_on'  => 'فعال',
  29.         'text_off' => 'غیرفعال',
  30.         'text_width' => 75,
  31.         'default' => false
  32.       ),
  33.       array(
  34.         'id'          => 'film_cat',
  35.         'type'        => 'select',
  36.         'title'       => 'انتخاب دسته بندی',
  37.         'placeholder' => 'دسته بندی را انتخاب کنید',
  38.         'chosen'      => true,
  39.         'ajax'        => false,
  40.         'multiple'    => false,
  41.         'sortable'    => true,
  42.         'options'     => 'categories',
  43.       ),
  44.     )
  45.   ));
  46.  
  47.  
  48.  
  49.   if (!function_exists('csf_widget_carousel_3')) {
  50.     function csf_widget_carousel_3($args, $instance)
  51.     { ?>
  52.       <aside class="widget widget-bg col-lg-12">
  53.         <div class="widget_title">
  54.           <h3><i class="<?= $instance['icon'] ?>"></i> <?= $instance['title'] ?></h3>
  55.           <?php if ($instance['archive']) : ?>
  56.             <a href="<?php echo get_category_link($instance['film_cat']); ?>" class="nav-link active carousel_archive"><?php _e('آرشیو', 'kelaketfilm'); ?></a>
  57.           <?php endif; ?>
  58.         </div>
  59.         <div class="widget_inner">
  60.           <div class="owl-carousel sidebar_carousel">
  61.             <?php
  62.             $query = new WP_Query(array(
  63.               'post_type' => 'post',
  64.               'posts_per_page' => $instance['count'],
  65.               'cat' => $instance['film_cat'],
  66.             ));
  67.             if ($query->have_posts()) :
  68.               while ($query->have_posts()) : $query->the_post(); ?>
  69.                 <a href="<?php the_permalink(); ?>">
  70.                   <div class="item2">
  71.                     <?php the_post_thumbnail('sidebar-thumb'); ?>
  72.                     <div class="item2__mask">
  73.                       <?php the_title(); ?>
  74.                     </div>
  75.                   </div>
  76.                 </a>
  77.               <?php endwhile; ?>
  78.               <?php wp_reset_postdata(); ?>
  79.             <?php endif; ?>
  80.  
  81.  
  82.           </div>
  83.         </div>
  84.       </aside>
  85.     <?php
  86.     }
  87.   }
  88.