/** * Widget Public Display * ------------------------------------------------------------------------- * @param array $defaults Widget default values. * @param array $instance Widget instance arguments. */ public function widget($defaults, $instance) { if (!empty($defaults['before_widget'])) { printf('%s', $defaults['before_widget']); } bh_category_widget_output($instance['category'], $instance['show_category_name'], 5); if (!empty($defaults['after_widget'])) { printf('%s', $defaults['after_widget']); } wp_reset_postdata(); }
$category_lead_post = array_slice($category_lead_post, 0, 1); } $featured_post_id = $category_lead_post[0]->ID; foreach ($category_lead_post as $post) { setup_postdata($post); kaitain_partial('article', 'archivelead'); } } /** * Subcategory Widgets * ----------------------------------------------------------------------------- */ if ($page_number < 2) { // Get category widgets. $children_categories = get_categories(array('parent' => $cat, 'orderby' => 'name', 'order' => 'ASC')); if (!empty($children_categories)) { foreach ($children_categories as $child) { bh_category_widget_output($child->cat_ID, 5); } } } if (have_posts() && $page_number || empty($children)) { while (have_posts()) { the_post(); if (get_the_ID() !== $featured_post_id) { kaitain_partial('article', 'archive'); } } } kaitain_partial('pagination', 'site'); get_footer();