function portfolio_query($args = null, $content = null) { // default template if (!isset($args['template']) || empty($args['template'])) { $args['template'] = 'grid-rows'; } // post type if (!isset($args['post_type']) || empty($args['post_type'])) { $args['post_type'] = 'portfolio'; } // orderby if (!isset($args['orderby']) || empty($args['orderby'])) { $args['orderby'] = 'menu_order'; // default by sort order } if (!isset($args['order']) || empty($args['order'])) { $args['order'] = 'ASC'; // default order } // categories if (isset($args['category'])) { $args['taxonomy_slug'] = 'portfolio-category'; $args['taxonomy_terms'] = $args['category']; unset($args['category']); } return custom_wp_query($args, $content); }
function shop_query($args = null, $content = null) { global $woocommerce_loop; if (class_exists('WooCommerce')) { $catalog_ordering_args = WC()->query->get_catalog_ordering_args(); if ($args == null) { $args = array(); } if (is_array($args)) { $args = array_merge($args, $catalog_ordering_args); } } // default template if (!isset($args['template']) || empty($args['template'])) { $args['template'] = 'shop-sidebar-left'; } // default product item if (!isset($args['product_item_size']) || empty($args['product_item_size'])) { $args['product_item_size'] = 'size-medium'; } // post type if (!isset($args['post_type']) || empty($args['post_type'])) { $args['post_type'] = 'product'; } // orderby if (!isset($args['orderby']) || empty($args['orderby'])) { $args['orderby'] = 'menu_order'; // default by sort order } if (!isset($args['order']) || empty($args['order'])) { $args['order'] = 'ASC'; // default order } // categories if (isset($args['category'])) { $args['taxonomy_slug'] = 'product_category'; //$args['taxonomy_terms'] = ; unset($args['category']); } $woocommerce_loop['product_item_size'] = $args['product_item_size']; return custom_wp_query($args, $content); }