Adding Pagination
-
Hi,
Looking to add pagination to the blog page on a site and I can’t seem to match the code with any examples in the codex. Any ideas?
<?php // Template Name: Blog Template get_header(); ?> <?php $loop = new WP_Query( array( 'post_type' => 'post', 'tax_query' => array( array( 'taxonomy' => 'category', 'field' => 'slug', 'terms' => 'blog', ), ), )); if( $loop->have_posts() ) : echo '<div class="container">'; while( $loop->have_posts() ) : $loop->the_post(); $image = get_field('featured_image'); echo '<div class="post_container" data-aos="fade-up" data-aos-offset="0" data-aos-duration="1000">'; echo '<div class="row justify-content-center align-items-center">'; echo '<div class="col col_3_12 post_image">'; echo '<img src="' . $image['url'] . '" alt="' . $image['alt'] . '" />'; echo '</div>'; echo '<div class="col col_9_12 post_content">'; echo '<h4><a href="' . get_the_permalink() . '">' . get_the_title() . '</a></h4>'; echo '<p>' . wp_trim_words( get_the_content(), 85, '... <a href="' . get_the_permalink() . '">Read more</a></p>' ); echo '<p class="date">' . get_the_date() . '</p>'; echo '</div>'; echo '</div>'; echo '</div>'; endwhile; wp_reset_query(); echo '</div>'; endif; ?> <?php get_footer(); ?>
Thanks!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Adding Pagination’ is closed to new replies.