/**
  * Output slides meta box.
  *
  * @param WP_Post $post
  */
 public static function slides_meta_box($post)
 {
     wp_nonce_field('ib_slideshow_slides_meta_box', 'ib_slideshow_slides_meta_box_nonce');
     // Get slideshow type.
     $slideshow_settings = get_post_meta($post->ID, '_ib_slideshow', true);
     $slideshow_type = '';
     if ($slideshow_settings && isset($slideshow_settings['type'])) {
         $slideshow_type = $slideshow_settings['type'];
     } else {
         $types = apply_filters('ib_slideshow_types', array());
         if (count($types)) {
             reset($types);
             $slideshow_type = key($types);
         }
     }
     if (empty($slideshow_type)) {
         return;
     }
     // Get slide fields given slideshow type.
     $fields = apply_filters('ib_slideshow_slide_fields', array());
     $meta = new IB_Slideshow_Meta($fields, $slideshow_type);
     // Get slides.
     $slides = IB_Slideshow::get_instance()->get_slides($post->ID);
     include 'templates/slides-meta-box.php';
 }
Exemplo n.º 2
0
 /**
  * Get instance of this class.
  *
  * @return IB_Slideshow
  */
 public static function get_instance()
 {
     if (!self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Exemplo n.º 3
0
/**
 * Output slideshow given its alias.
 *
 * @param string $slug
 * @return string
 */
function educator_slideshow($slug, $type = '')
{
    if (!$slug || !class_exists('IB_Slideshow')) {
        return '';
    }
    $ibs = IB_Slideshow::get_instance();
    $slideshow = $ibs->get_slideshow_by('slug', $slug);
    if (!$slideshow) {
        return '';
    }
    $slides = $ibs->get_slides($slideshow->ID);
    if (!$slides) {
        return '';
    }
    $settings = $ibs->get_slideshow_settings($slideshow->ID);
    $slideshow_type = isset($settings['type']) ? $settings['type'] : 'default';
    switch ($slideshow_type) {
        case 'default':
            return educator_fw_slideshow($slides, $settings, $type);
        case 'post':
            return educator_post_slideshow($slides, $settings);
    }
}