Skip to content

Instantly share code, notes, and snippets.

@neilgee
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neilgee/9181028 to your computer and use it in GitHub Desktop.
Save neilgee/9181028 to your computer and use it in GitHub Desktop.
WordPress onPage Loop - Certain Cat Infinite Posts
<?php
// args
$args = array(
'cat' => 14,
'numberposts' => -1
);
// get results
$the_query = new WP_Query( $args );
// The Loop
?>
<?php if( $the_query->have_posts() ): ?>
<ul>
<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<li>
<div class="entry">
<div class="entry-thumbnail">
<a href="<?php echo the_field('media_source_link') ?>" class="lbp_secondary" target="_blank">
<?php if ( has_post_thumbnail() )
{ // check if the post has a Post Thumbnail assigned to it.
the_post_thumbnail();
}
?>
</a>
</div>
<p class="entry-title"><a href="<?php echo the_field('media_source_link') ?>" rel="bookmark" title="Permanent Link to <?php echo the_field('media_source_link') ?>" target="_blank"><?php the_title(); ?></a></p>
<div class="entry-excerpt">
<?php the_content(); ?>
</div>
<a href="<?php echo the_field('media_source_link') ?>" target="_blank"><img src="<?php bloginfo('url'); ?>/wp-content/themes/hello/images/READMORE.png" class="readmore-media" /></a>
<br class="clear" />
<div class="social-share"> <?php if(function_exists('kc_add_social_share')) kc_add_social_share(); ?></div>
<br class="clear" />
</div>
<br class="clear" />
</li>
<?php endwhile; ?>
</ul>
<?php endif; ?>
<?php wp_reset_query(); // Restore global post data stomped by the_post(). ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment