Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * The main template file.
- *
- * This is the most generic template file in a WordPress theme
- * and one of the two required files for a theme (the other being style.css).
- * It is used to display a page when nothing more specific matches a query.
- * E.g., it puts together the home page when no home.php file exists.
- * Learn more: http://codex.wordpress.org/Template_Hierarchy
- *
- * @package _s
- */
- get_header(); ?>
- <div id="primary" class="content-area col-md-8">
- <main id="main" class="site-main" role="main">
- <div class="row">
- <div class="gamecam col-lg-12">
- <h3>Game Cam Photos</h3>
- <?php
- $args = array( 'post_type' => 'attachment', 'posts_per_page' => 3, 'post_mime_type' => 'image', 'order' => DESC, 'post_status' =>'any', 'post_parent' => $post->ID );
- $query = new WP_Query( array( 'category_name' => 'game-cam', 'posts_per_page' => 1 ) );
- ?>
- <?php while ( $query->have_posts() ) : $query->the_post(); ?>
- <?php
- $images = get_posts( $args );
- if ( $images ) {
- foreach ( $images as $image ) { ?>
- <div class="col-md-4 col-sm-6"><div class="gamecam-pic"><a href="<?php echo wp_get_attachment_url( $image->ID , 'medium' ); ?>" rel="lightbox"><?php echo wp_get_attachment_image( $image->ID, 'gamecam img-responsive' ); ?></a></div></div>
- <?php }
- } ?>
- <?php
- // Reset Query
- wp_reset_postdata();
- endwhile;
- ?>
- <div class="col-md-12"><a href="<?php echo get_permalink(); ?>"><h4>View All Game Pics</h4></a></div>
- </div><!-- end .gamecam -->
- </div><!-- end .row -->
- <div class="row">
- <div class="col-lg-12">
- <h3 class="latest-news">Latest News</h3>
- </div>
- </div>
- <?php if ( have_posts() ) : ?>
- <?php /* Start the Loop */ ?>
- <?php while ( have_posts() ) : the_post(); ?>
- <?php
- /*
- * Include the Post-Format-specific template for the content.
- * If you want to override this in a child theme, then include a file
- * called content-___.php (where ___ is the Post Format name) and that will be used instead.
- */
- get_template_part( 'template-parts/content', get_post_format() );
- ?>
- <?php endwhile; ?>
- <?php the_posts_navigation(); ?>
- <?php else : ?>
- <?php get_template_part( 'template-parts/content', 'none' ); ?>
- <?php endif; ?>
- </main><!-- #main -->
- </div><!-- #primary -->
- <?php get_sidebar(); ?>
- <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment