Skip to content
This repository
tree: a11894f476
Fetching contributors…

Cannot retrieve contributors at this time

file 70 lines (58 sloc) 1.572 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
<?php
if ( ! is_home() || is_paged() )
return;

/*
* Do we have sticky posts?
* If so, we will store them in an array.
*/
$stickies = array();
while ( have_posts() ) {
the_post();
if ( is_sticky() )
$stickies[] = $post;
}

/*
* Display first sticky.
*
* The first sticky post will be displayed
* in the intro div. We will pop it of the
* sticky array before it is displayed.
*/
if ( ! empty( $stickies ) ) :
$post = array_pop( $stickies );
setup_postdata( $post );
$image = get_the_post_thumbnail();
?>

<header id="intro"<?php echo ( ! empty( $image ) ) ? ' class="has-image"' : ''; ?>>

<?php the_title( '<h1 id="document-title"><a href="' . esc_url( get_permalink() ) . '">', '</a></h1>' ); ?>

<?php if ( ! empty( $image ) ) : ?>
<div id="image"><a href="<?php echo esc_url( get_permalink() ); ?>"><?php echo $image; ?></a></div>
<?php endif; ?>

<div id="summary">
<?php the_content( __( 'Continue Reading', 'nighthawk' ) ); ?>
</div>

<?php wp_link_pages( array(
'before' => '<div class="page-link contain">',
'after' => '</div>'
) ); ?>

</header>

<?php endif; ?>

<?php
/*
* All other stickies.
*
* Any remaining stickies will be displayed
* in a custom list under the intro.
*/
?>

<?php if ( ! empty( $stickies ) ) : ?>
<div id="featured-posts">
<ul id="intro-list"><?php
foreach ( $stickies as $i => $post ) {
setup_postdata( $post );
the_title( "\n\t\t" . '<li><a href="' . esc_url( get_permalink() ) . '">', '</a></li>' );
}
?></ul>
</div>
<?php endif; ?>

<?php wp_reset_postdata(); ?>
Something went wrong with that request. Please try again.