예제 #1
0
 /**
  * Modify DPS shortcode query args.
  *
  * @since   0.1.1
  * @access  public
  * @uses    WP_Bootstrap_Carousel_DPS::$found_posts
  * @uses    WP_Bootstrap_Carousel_DPS::is_bootstrap()
  * @uses    WP_Bootstrap_Carousel_DPS::is_attachment_query()
  * @uses    WP_Bootstrap_Carousel_DPS::is_meta_query()
  * @param   array   $args           The output array of the DPS shortcode query args.
  * @param   array   $original_atts  Original attributes passed to the shortcode.
  * @return  array                   Modified output array of the DPS shortcode query args.
  */
 public function display_posts_shortcode_args($args, $original_atts)
 {
     // check bootstrap attribute
     if (!$this->is_bootstrap($original_atts)) {
         return $args;
     }
     // add 'inherit' post status if attachments are queried
     if ($this->is_attachment_query($original_atts)) {
         $args['post_status'] = array_unique(array_merge(array('inherit'), $args['post_status']));
     }
     // make sure posts have a thumbnail, but do not interfere with existing meta query
     if (!$this->is_attachment_query($original_atts) && !$this->is_meta_query($original_atts)) {
         $args['meta_key'] = '_thumbnail_id';
     }
     // get number of found posts
     $listing = new WP_Query($args);
     if ($listing->have_posts()) {
         self::$found_posts = $listing->found_posts;
     }
     // reset query
     wp_reset_postdata();
     // return query args
     return $args;
 }
예제 #2
0
 /**
  * Include and instantiate DPS addon.
  *
  * @since   0.1.1
  * @access  public
  * @uses    WP_Bootstrap_Carousel_DPS
  * @return  object
  */
 public function be_display_posts_plugin()
 {
     if (!class_exists('WP_Bootstrap_Carousel_DPS')) {
         include 'inc/wp-bootstrap-carousel-dps.php';
         WP_Bootstrap_Carousel_DPS::instance();
     }
 }