public function archive_post_content($html) { if (!$html) { ob_start(); presscore_populate_team_config(); presscore_get_template_part('mod_team', 'team-post'); $html = ob_get_contents(); ob_end_clean(); } return $html; }
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' => 'term_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()) { update_post_thumbnail_cache($p_query); echo '<ul class="team-items slider-content round-images bg-under-post rsContW"' . ($autoslide ? ' data-autoslide="' . $autoslide . '"' : '') . '>', "\n"; // get config instance $config = Presscore_Config::get_instance(); // backup and reset config $config_backup = $config->get(); $this->setup_config($instance); while ($p_query->have_posts()) { $p_query->the_post(); presscore_populate_team_config(); echo '<li>'; $this->render_teammate($instance); echo '</li>'; } // while have posts wp_reset_postdata(); // restore config $config->reset($config_backup); echo '</ul>', "\n"; } // if have posts echo $after_widget . "\n"; }
public function shortcode($atts, $content = null) { $attributes = $this->sanitize_attributes($atts); if (presscore_vc_is_inline()) { $terms_list = presscore_get_terms_list_by_slug(array('slugs' => $attributes['category'], 'taxonomy' => 'dt_team_category')); $dummy = ' <div class="dt_vc-shortcode_dummy dt_vc-team" style="height: 250px;"> <h5>Team</h5> <p class="text-small"><strong>Display categories:</strong> ' . $terms_list . '</p> </div> '; return $dummy; } $output = ''; $dt_query = $this->get_posts_by_terms($attributes); if ($dt_query->have_posts()) { $this->backup_post_object(); $this->backup_theme_config(); $this->setup_config($attributes); ob_start(); do_action('presscore_before_shortcode_loop', $this->shortcode_name, $attributes); if ($attributes['full_width']) { echo '<div class="full-width-wrap">'; } echo '<div ' . presscore_masonry_container_class(array('wf-container')) . presscore_masonry_container_data_atts() . '>'; while ($dt_query->have_posts()) { $dt_query->the_post(); presscore_populate_team_config(); dt_get_template_part('team/team-post'); } echo '</div>'; if ($attributes['full_width']) { echo '</div>'; } do_action('presscore_after_shortcode_loop', $this->shortcode_name, $attributes); $output .= ob_get_contents(); ob_end_clean(); $this->restore_theme_config(); $this->restore_post_object(); } return $output; }
} else { // fullwidth wrap open if ($config->get('full_width')) { echo '<div class="full-width-wrap">'; } // masonry container open echo '<div ' . presscore_masonry_container_class(array('wf-container')) . presscore_masonry_container_data_atts() . '>'; ////////////////////// // Custom loop // ////////////////////// $page_query = Presscore_Inc_Team_Post_Type::get_template_query(); if ($page_query->have_posts()) { while ($page_query->have_posts()) { $page_query->the_post(); // populate config presscore_populate_team_config(); dt_get_template_part('team/team-post'); } wp_reset_postdata(); } // masonry container close echo '</div>'; // fullwidth wrap close if ($config->get('full_width')) { echo '</div>'; } ///////////////////// // Pagination // ///////////////////// dt_paginator($page_query); }