public static function get_instance()
 {
     if (!isset(self::$instance)) {
         self::$instance = new self();
     }
     return self::$instance;
 }
示例#2
0
 /**
  * Order the parameters and query the DB for posts
  */
 private function set_lcp_parameters()
 {
     $args = $this->lcp_categories();
     $processed_params = LcpParameters::get_instance()->get_query_params($this->params);
     $args = array_merge($args, $processed_params);
     $args = $this->check_pagination($args);
     // for WP_Query compatibility
     // http://core.trac.wordpress.org/browser/tags/3.7.1/src/wp-includes/post.php#L1686
     $args['posts_per_page'] = $args['numberposts'];
     $query = new WP_Query();
     $this->lcp_categories_posts = $query->query($args);
     $this->posts_count = $query->found_posts;
     remove_all_filters('posts_orderby');
     remove_filter('posts_where', array($this, 'starting_with'));
 }