/** * Internal method that returns all sliders created on the site. * * @since 1.0.0 * * @return array|bool Array of slider data or false if none found. */ public function _get_sliders() { $sliders = get_posts(array('post_type' => 'any', 'no_found_rows' => true, 'cache_results' => false, 'nopaging' => true, 'fields' => 'ids', 'meta_query' => array(array('key' => '_sol_slider_data')))); if (empty($sliders)) { return false; } // Now loop through all the sliders found and only use sliders that have images in them. $ret = array(); foreach ($sliders as $id) { $data = get_post_meta($id, '_sol_slider_data', true); if (empty($data['slider']) && 'default' == Soliloquy_Shortcode_Lite::get_instance()->get_config('type', $data) || 'dynamic' == Soliloquy_Shortcode_Lite::get_instance()->get_config('type', $data)) { continue; } $ret[] = $data; } // Return the slider data. return $ret; }
/** * Returns the singleton instance of the class. * * @since 1.0.0 * * @return object The Soliloquy_Shortcode_Lite object. */ public static function get_instance() { if (!isset(self::$instance) && !self::$instance instanceof Soliloquy_Shortcode_Lite) { self::$instance = new Soliloquy_Shortcode_Lite(); } return self::$instance; }
/** * Internal method that returns all sliders created on the site. * * @since 1.0.0 * * @return array|bool Array of slider data or false if none found. */ public function _get_sliders() { $sliders = new WP_Query(array('post_type' => 'any', 'post_status' => 'publish', 'posts_per_page' => -1, 'fields' => 'ids', 'meta_query' => array(array('key' => '_sol_slider_data', 'compare' => 'EXISTS')))); if (!isset($sliders->posts) || empty($sliders->posts)) { return false; } // Now loop through all the sliders found and only use sliders that have images in them. $ret = array(); foreach ($sliders->posts as $id) { $data = get_post_meta($id, '_sol_slider_data', true); if (empty($data['slider']) && 'default' == Soliloquy_Shortcode_Lite::get_instance()->get_config('type', $data) || 'dynamic' == Soliloquy_Shortcode_Lite::get_instance()->get_config('type', $data)) { continue; } $ret[] = $data; } // Return the slider data. return $ret; }