
featured post loop
By:
lonchbox on
Mar 29th, 2012 | syntax:
PHP | size: 1.08 KB | hits: 43 | expires: Never
<?php
// Get the page as an Object
$featured_args = array(
'posts_per_page' => 1,
'post__in' => get_option( 'sticky_posts' ),
'public' => true,
'ignore_sticky_posts' => 1,
'post_type' => 'post'
);
// The Featured Posts query.
$featured = new WP_Query( $featured_args );
// Proceed only if published posts exist
if ( $featured->have_posts() ) :
?>
<section id="featured-posts">
<h2 class="featured-heading"><?php _e( 'Destacado', 'lonchpress' ); ?></h2>
<?php
// Let's roll.
while ( $featured->have_posts() ) : $featured->the_post();
/**
* We're going to add a class to our featured post for featured images
* by default it'll have the feature-text class.
*/
$feature_class = 'feature-text';
?>
<div class="row <?php echo $feature_class; ?>">
<?php get_template_part( 'content', 'featured' ); ?>
</div>
<?php endwhile; ?>
</section><!-- .featured-posts -->
<?php endif; // End check for sticky posts. ?>