/** * * * @package Kopa * @subpackage Core * @author thethangtran <*****@*****.**> * @since 1.0.0 * */ public function __construct($args = array()) { parent::__construct($args); $this->options = array(); $pages = get_pages(array('sort_order' => 'ASC', 'sort_column' => 'post_title', 'hierarchical' => 1, 'exclude' => '', 'include' => '', 'meta_key' => '', 'meta_value' => '', 'authors' => '', 'child_of' => 0, 'parent' => -1, 'exclude_tree' => '', 'number' => '', 'offset' => 0, 'post_type' => 'page', 'post_status' => 'publish')); $this->options[0] = __('-- Select Page --', kopa_get_domain()); foreach ($pages as $page) { $this->options[$page->ID] = $page->post_title; } }
/** * * * @package Kopa * @subpackage Core * @author thethangtran <*****@*****.**> * @since 1.0.0 * */ public function __construct($args = array()) { parent::__construct($args); $this->min = isset($args['min']) ? (int) $args['min'] : 0; $this->max = isset($args['max']) ? (int) $args['max'] : 12; $this->step = isset($args['step']) ? (int) $args['step'] : 1; $this->suffix = isset($args['suffix']) ? $args['suffix'] : ''; $this->prefix = isset($args['prefix']) ? $args['prefix'] : ''; if ($this->min < $this->max) { for ($i = $this->min; $i <= $this->max; $i = $i + $this->step) { $this->options[$i] = $this->prefix . $i . $this->suffix; } } }
/** * * * @package Kopa * @subpackage Core * @author thethangtran <*****@*****.**> * @since 1.0.0 * */ public function __construct($args = array()) { parent::__construct($args); $this->post_type = isset($args['post_type']) ? $args['post_type'] : array('post'); $this->posts_per_page = isset($args['posts_per_page']) ? $args['posts_per_page'] : -1; $this->args_extra = isset($args['args_extra']) ? $args['args_extra'] : array(); $this->options = array(); $this->options[0] = __('-- Select --', kopa_get_domain()); $args = array('post_type' => $this->post_type, 'posts_per_page' => $this->posts_per_page, 'post_status' => array('publish'), 'ignore_sticky_posts' => true); if (!empty($this->args_extra)) { $args = array_merge($args, $this->args_extra); } $posts = new WP_Query($args); if ($posts->have_posts()) { while ($posts->have_posts()) { $posts->the_post(); $post_id = get_the_ID(); $post_title = get_the_title(); $this->options[$post_id] = $post_title; } } wp_reset_postdata(); }
/** * * * @package Kopa * @subpackage Core * @author thethangtran <*****@*****.**> * @since 1.0.0 * */ public function __construct($args = array()) { parent::__construct($args); $this->taxonomy = isset($args['taxonomy']) ? $args['taxonomy'] : 'category'; }