/** * Get the current filter items for a portfolio page. * * @param array $args The portfolio loop parameters. * @return array */ function thb_portfolio_get_filter_terms($args = array()) { $args = thb_post_type_query_args('works', null, $args); $terms_args = array(); if (isset($args['tax_query'])) { foreach ($args['tax_query'] as $tax_query) { if ($tax_query['taxonomy'] == 'portfolio_categories') { if ($tax_query['operator'] == 'IN') { $terms_args['include'] = $tax_query['terms']; } elseif ($tax_query['operator'] == 'NOT IN') { $terms_args['exclude'] = $tax_query['terms']; } } } } $terms = get_terms('portfolio_categories', $terms_args); return $terms; }
/** * Retrieve the collection items from a specific post type. * * @return void */ protected function retrievePostSlides() { $args = thb_post_type_query_args('slideshows', $this->_id); /** * Default arguments */ $defaultArgs = array('paged' => 1, 'meta_key' => '_thumbnail_id', 'post_type' => $this->_type, 'posts_per_page' => '-1'); $args = thb_array_asum($defaultArgs, $args); foreach (get_posts($args) as $item) { $thumb_id = get_post_thumbnail_id($item->ID); $this->_slides[] = array('post_id' => $item->ID, 'id' => $thumb_id, 'url' => thb_image_get_size($thumb_id, $this->_size), 'full' => thb_get_featured_image($item->ID, 'full'), 'thumb' => thb_get_featured_image($item->ID, $this->_thumbSize), 'caption' => '', 'type' => 'image', 'link' => false); } }
function thb_works_query($params = array()) { global $wp_query; $post_type = 'works'; $args = thb_post_type_query_args($post_type); $args = thb_array_asum($args, $params); thb_query_posts($post_type, $args); }
function thb_post_query($override = array()) { global $wp_query; $post_type = 'post'; $args = thb_post_type_query_args($post_type); $args = thb_array_asum($args, $override); thb_query_posts($post_type, $args); }