Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- get_header();
- ?>
- <div id="main-content">
- <div id="mj-main-banner" style="background-image: url('<?php the_field('mj_banner_image'); ?>');"></div>
- <div class="container">
- <div id="content-area" class="clearfix">
- <?php while ( have_posts() ) : the_post(); ?>
- <article id="post-<?php the_ID(); ?>">
- <div class="et_post_meta_wrapper">
- <h2><?php the_field('trip_title'); ?></h2> <!-- ACF variable -->
- </div> <!-- .et_post_meta_wrapper -->
- <div class="entry-content">
- <?php
- the_field('details_about_this_trip');
- ?>
- </div> <!-- .entry-content -->
- </article>
- <?php endwhile; ?>
- </div> <!-- #content-area -->
- <div id="blog-grid-minor">
- <h3>Blog Posts for this trip</h3>
- <!-- Search all posts for those with the category for this trip -->
- <?php
- $args = array(
- 'post_type' => 'post',
- 'posts_per_page' => 6,
- 'order' => 'desc',
- 'orderby' => 'date',
- 'tax_query' => array(
- array(
- 'taxonomy' => 'category',
- 'field' => 'slug',
- 'terms' => get_field('category_to_display'), // category from the custom field
- ),
- ),
- );
- // Get current page and append to custom query parameters array
- $args['paged'] = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
- $the_query = new WP_Query( $args );
- // Pagination fix
- $temp_query = $wp_query;
- $wp_query = NULL;
- $wp_query = $the_query;
- ?>
- <!-- This line is here for purposes of error checking during process of getting pagination to work -->
- <?php
- echo "<p style='color: blue;'><strong>";
- echo "The total number of pages to display is: " . $the_query->max_num_pages;
- echo "</strong></p>";
- ?>
- <div id="fwd-blog-grid">
- <?php if ( $the_query->have_posts() ) : ?>
- <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
- <div class="fwd-grid-item">
- <?php if ( has_post_thumbnail() ) {
- the_post_thumbnail();
- } ?>
- <h2><a href='<?php the_permalink(); ?>'><?php the_title(); ?></a></h2>
- <div class="entry-content">
- <a href='<?php the_permalink(); ?>'><?php the_excerpt(); ?></a>
- </div>
- </div>
- <?php endwhile; ?>
- <?php
- wp_reset_postdata();
- echo "<div style='clear: both;'>";
- //wp_pagenavi( array( 'query' => $the_query ) );
- echo "<div style='float: right;'>";
- next_posts_link( '« Newer Posts', $the_query->max_num_pages );
- echo "</div>";
- echo "<div style='float: left;'>";
- previous_posts_link( 'Older Posts »' );
- echo "</div>";
- echo "</div>";
- // Reset main query object
- $wp_query = NULL;
- $wp_query = $temp_query;
- ?>
- <?php else: ?>
- <p style="text-align: center;">There are no blog posts to display. Mianne is still sorting this bit of code out! :) </p>
- <p style="text-align: center;">We might be out of signal range, but will be sure to add a blog post as soon as we can.</p>
- <?php endif; ?>
- </div>
- </div> <!-- #blog-grid-minor" -->
- </div> <!-- .container -->
- </div> <!-- #main-content -->
- <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement