function mp_list_products_sc($atts) { extract(shortcode_atts(array('paginate' => '', 'page' => '', 'per_page' => '', 'order_by' => '', 'order' => '', 'category' => '', 'tag' => ''), $atts)); return mp_list_products(false, $paginate, $page, $per_page, $order_by, $order, $category, $tag); }
function mp_list_products_sc($atts) { global $mp; $args = shortcode_atts($mp->defaults['list_products'], $atts); $args['echo'] = false; return mp_list_products($args); }
function product_taxonomy_list_theme($content) { //don't filter outside of the loop if (!in_the_loop()) { return $content; } $msgs = $this->get_setting('msg'); $content = do_shortcode($msgs['product_list']); $content .= mp_list_products(false); $content .= '<div id="mp_product_nav">' . get_posts_nav_link() . '</div>'; return $content; }
/** * ajax handler * @return string html of products list, and optionally pagination */ function get_products_list() { global $wp_query; $ret = array('products' => false, 'pagination' => false); $args = wp_parse_args(array('echo' => false, 'filters' => false), $this->defaults['list_products']); if (isset($_POST['order'])) { $o = explode('-', $_POST['order']); // column if (isset($o[0]) && in_array($o[0], array('date', 'title', 'price', 'sales'))) { $args['order_by'] = $o[0]; } // direction if (isset($o[1]) && in_array($o[1], array('asc', 'desc'))) { $args['order'] = strtoupper($o[1]); } } if (isset($_POST['per_page'])) { $args['per_page'] = intval($_POST['per_page']); $args['paginate'] = true; } if (isset($_POST['product_category']) && is_numeric($_POST['product_category'])) { $term = get_term_by('id', $_POST['product_category'], 'product_category'); $args['category'] = $term->slug; } if (isset($_POST['page']) && is_numeric($_POST['page'])) { $args['page'] = $_POST['page']; } $ret['products'] = mp_list_products($args); wp_send_json($ret); }