Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Template Name: All-Posts Archive Page
- */
- ?>
- <?php get_header(); ?>
- <section class="content">
- <?php get_template_part('inc/page-title'); ?>
- <div class="pad group">
- <?php if ((category_description() != '') && !is_paged()) : ?>
- <div class="notebox">
- <?php echo category_description(); ?>
- </div>
- <?php endif; ?>
- <?php
- // Add custom query to retrieve all posts
- // set up archive arguments
- $archive_args = array(
- post_type => 'post', // get only posts
- 'posts_per_page'=> -1 // this will display all posts on one page
- );
- // new instance of WP_Quert
- $archive_query = new WP_Query( $archive_args );
- ?>
- <?php if ( have_posts() ) : ?>
- <?php if ( ot_get_option('blog-standard') == 'on' ): ?>
- <!-- use the custom query -->
- <?php while ( $archive_query->have_posts() ): $archive_query->the_post(); ?>
- <?php get_template_part('content-standard'); ?>
- <?php endwhile; ?>
- <?php else: ?>
- <div class="post-list group">
- <!-- use the custom query -->
- <?php $i = 1; echo '<div class="post-row">'; while ( $archive_query->have_posts() ): $archive_query->the_post(); ?>
- <?php get_template_part('content'); ?>
- <?php if($i % 2 == 0) { echo '</div><div class="post-row">'; } $i++; endwhile; echo '</div>'; ?>
- </div><!--/.post-list-->
- <?php endif; ?>
- <?php get_template_part('inc/pagination'); ?>
- <?php endif; ?>
- </div><!--/.pad-->
- </section><!--/.content-->
- <?php wp_reset_postdata(); // always reset post data after a custom query ?>
- <?php get_sidebar(); ?>
- <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment