/** * Renders the zone in HTML. * @since 2.0 */ public function render() { global $wp_query, $post, $ar2_is_customize_preview; if ($ar2_is_customize_preview) { $this->settings['_preview'] = true; } if (!$this->settings['_preview'] && !$this->settings['enabled']) { return false; } // For developers to place code before the post section. do_action('ar2_before_section-' . $this->id); if (!is_a($this->query, 'WP_Query')) { $this->prepare_query(); } // Check if the query has posts first! if ($this->query->have_posts()) { if ($this->settings['container']) { echo '<div id="section-' . $this->id . '" class="clearfix"'; if (!$this->settings['enabled']) { echo ' style="display: none"'; } echo '>'; } if (isset($this->settings['title'])) { echo '<h4 class="home-title">' . $this->settings['title'] . '</h4>'; } if ($this->settings['type'] == 'line' || $this->settings['type'] == 'quick') { echo '<ul class="hfeed posts-' . $this->settings['type'] . '">'; } else { echo '<div class="hfeed posts-' . $this->settings['type'] . '">'; } if ($this->settings['type'] == 'node') { for ($i = 0; $this->query->have_posts(); $i++) { if ($i % 3 == 0) { echo '<div class="clearfix">'; } $this->query->the_post(); // hack for plugin authors who love to use $post = $wp_query->post $wp_query->post = $this->query->post; setup_postdata($post); get_template_part('section', $this->settings['type']); if ($i % 3 == 2) { echo '</div>'; } // Update the post blacklist. $this->zone->blacklist[] = $post->ID; } if ($i % 3 != 0) { echo '</div>'; } } else { while ($this->query->have_posts()) { $this->query->the_post(); // hack for plugin authors who love to use $post = $wp_query->post $wp_query->post = $this->query->post; setup_postdata($post); get_template_part('section', $this->settings['type']); // Update the post blacklist. $this->zone->blacklist[] = $post->ID; } } if ($this->settings['type'] == 'line' || $this->settings['type'] == 'quick') { echo '</ul><!-- .posts-' . $this->settings['type'] . '-->'; } else { echo '</div><!-- .posts-' . $this->settings['type'] . '-->'; } if ($this->settings['use_main_query'] && $this->query->max_num_pages > 1) { ar2_post_navigation(); } if ($this->settings['container']) { echo '</div><!-- #section-' . $this->id . '-->'; } } else { // We'll put up a notice if there are no posts in the next patch. } // For developers to place code after the post section. do_action('ar2_after_section-' . $this->id); }
if (is_active_sidebar('Bottom Content #2')) { ?> <div class="bottom-sidebar" id="bottom-content-2" role="complementary"> <?php if (!dynamic_sidebar('Bottom Content #2')) { ?> <?php } ?> </div> <?php } ?> <?php ar2_post_navigation(); } else { ?> <?php $wp_query = new WP_Query(array('paged' => $paged, 'posts_per_page' => $posts_per_page)); if ($wp_query->have_posts()) { ?> <h1 class="archive-title"><?php _e('Blog Archives', 'ar2'); ?> </h1> <div id="archive-posts"> <?php ar2_render_posts(null, array('type' => ar2_get_theme_option('archive_display')), true); ?>