Hi all, I’m basically attempting to use a Featured Post banner combined with javascript for a slide function. Besides it acting different for some reason between my local hosted version and the online version, its being difficult to manage.
I’m running the below code, but it appears to be returning posts IF it doesn’t find sticky posts, so it shows the featured banner (empty). How do I make the query just stop if it doesn’t find exactly what I have asked for?
<?php if(is_front_page() && !is_paged()) {
$featured_args = array(
'post__in' => get_option( 'sticky_posts' ),
'post_status' => 'publish',
'no_found_rows' => true
); ?>
<?php $featured = new WP_Query($featured_args);
if ( $featured->have_posts() ) { ?>
<div id="featured">
<div id="featbanner" class="maxwidth">
<div id="featcontainer" >
<?php while ($featured->have_posts()) : $featured->the_post(); ?>
<?php if (!is_sticky($featured->ID)) continue; ?>
<article class="sticky ">
<div class="desc">
<h2><?php the_title(); ?></h2>
<div class="entry-content">
<?php excerpt('26'); ?>
</div>
<div class="post-info">
<a href="<?php the_permalink(); ?>" class="call-to-action-alt">Continue Reading</a>
</div>
</div>
<?php
if (has_post_thumbnail()) {
the_post_thumbnail(('large'),
array(
'class' => 'thumbnail',
'alt' => 'post thumbnail',
'title' => 'my custom title'));
}
?>
</article>
<?php endwhile; ?>
</div><!--featcontainer-->
<?php wp_reset_postdata(); ?>
<div id="banner-nav"></div>
</div><!--featbanner-->
</div><!--featured-->
<?php }?>