function __construct($atts = array(), $params = array()) { $atts['skin'] = isset($atts['skin']) && $atts['skin'] ? $atts['skin'] : 'default'; $atts['hide_filters'] = isset($atts['hide_filters']) && $atts['hide_filters'] ? 1 : 0; $atts['orderby'] = isset($atts['orderby']) && $atts['orderby'] ? $atts['orderby'] : 'menu_order'; $atts['order'] = isset($atts['order']) && $atts['order'] ? $atts['order'] : 'ASC'; $atts['maxposts'] = isset($atts['maxposts']) && $atts['maxposts'] ? $atts['maxposts'] : 20; $this->ID = isset($atts['id']) && $atts['id'] ? $atts['id'] : uniqid("np-"); $this->items = null; $this->atts = $atts; $this->skin = $atts['skin']; $this->skinObj = apply_filters("nimble_portfolio_skin_get_{$this->skin}", null); // set Post Type if (isset($params['post_type']) && $params['post_type']) { $this->postType = $params['post_type']; } else { $this->postType = isset($atts['post_type']) && $atts['post_type'] ? $atts['post_type'] : NimblePortfolioPlugin::getPostType(); } //set Taxonomy if (isset($params['taxonomy']) && $params['taxonomy']) { $this->taxonomy = $params['taxonomy']; } else { $this->taxonomy = isset($atts['taxonomy']) ? $atts['taxonomy'] : NimblePortfolioPlugin::getTaxonomy(); } // construct WP_Query $this->items_ids = array(); $args = array(); $args['post_type'] = $this->postType; $args['posts_per_page'] = -1; $args['fields'] = 'ids'; $args['orderby'] = $atts['orderby']; $args['order'] = $atts['order']; $args['post_status'] = 'publish'; if (isset($atts['showposts']) && $atts['showposts']) { $args['showposts'] = $atts['showposts']; } $args = apply_filters('nimble_portfolio_query_args', $args, $this); $this->queryObj = new WP_Query($args); if ($this->queryObj->have_posts()) { $this->items_ids = $this->queryObj->get_posts(); } wp_reset_postdata(); }
<?php $skins = apply_filters('nimble_portfolio_skin_register', array()); $post_types = get_post_types(array('public' => true), 'objects'); $taxonomies = get_object_taxonomies(NimblePortfolioPlugin::getPostType(), 'objects'); ?> <script> jQuery(document).ready(function ($) { var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?> '; var loaderurl = '<?php echo admin_url('images/loading.gif'); ?> '; $('#nimble_portfolio_generate').click(function (e) { //Create gallery Shortcode var post_type = jQuery('#nimble_portfolio_shortcode_post_type').val(); var taxonomy = jQuery('#nimble_portfolio_shortcode_taxonomy').val(); var skin = jQuery('#nimble_portfolio_shortcode_skin').val(); var hide_filters = jQuery('#nimble_portfolio_shortcode_hide_filters').is(':checked'); var orderby = jQuery('#nimble_portfolio_shortcode_orderby').val(); var order = jQuery('#nimble_portfolio_shortcode_order').val(); var params = ''; if (post_type) { params += 'post_type="' + post_type + '" '; }