function widget($args, $instance) { extract($args); $instance = wp_parse_args((array) $instance, self::$widget_defaults); /* Our variables from the widget settings. */ $title = apply_filters('widget_title', $instance['title']); $args = array('no_found_rows' => 1, 'posts_per_page' => $instance['show'], 'post_type' => 'dt_team', 'post_status' => 'publish', 'orderby' => $instance['orderby'], 'order' => $instance['order'], 'tax_query' => array(array('taxonomy' => 'dt_team_category', 'field' => 'id', 'terms' => $instance['cats']))); switch ($instance['select']) { case 'only': $args['tax_query'][0]['operator'] = 'IN'; break; case 'except': $args['tax_query'][0]['operator'] = 'NOT IN'; break; default: unset($args['tax_query']); } $p_query = new WP_Query($args); $autoslide = absint($instance['autoslide']); echo $before_widget . "\n"; // title if ($title) { echo $before_title . $title . $after_title . "\n"; } if ($p_query->have_posts()) { echo '<ul class="team-items slider-content rsContW"' . ($autoslide ? ' data-autoslide="' . $autoslide . '"' : '') . '>', "\n"; // get config instance $config = Presscore_Config::get_instance(); // backup and reset config $config_backup = $config->get(); $config->reset(array()); while ($p_query->have_posts()) { $p_query->the_post(); echo '<li>' . Presscore_Inc_Team_Post_Type::render_teammate() . '</li>'; } // while have posts wp_reset_postdata(); // restore config $config->reset($config_backup); echo '</ul>', "\n"; } // if have posts echo $after_widget . "\n"; }
<?php /** * Team content. * * @since presscore 1.0 */ // File Security Check if (!defined('ABSPATH')) { exit; } ?> <?php do_action('presscore_before_post'); ?> <?php echo Presscore_Inc_Team_Post_Type::render_teammate(); ?> <?php do_action('presscore_after_post');