Created
July 13, 2011 01:05
-
-
Save mfields/1079539 to your computer and use it in GitHub Desktop.
Sticky Posts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| if ( ! have_posts() ) { | |
| /** | |
| * @todo Some kinda 404 stuff here... | |
| */ | |
| } | |
| /* | |
| * Loop for Sticky Posts. | |
| */ | |
| $stickies = array(); | |
| while ( have_posts() ) { | |
| the_post(); | |
| if ( ! is_sticky() ) { | |
| continue; | |
| } | |
| $stickies[] = $post; | |
| } | |
| if ( ! empty( $stickies ) ) { | |
| $post = array_pop( $stickies ); | |
| setup_postdata( $post ); | |
| print "\n" . '<div id="intro">'; | |
| the_title( "\n" . '<h1>', '</h1>' ); | |
| print "\n" . '<div id="summary">'; | |
| the_content(); | |
| print "\n" . '</div>'; | |
| wp_link_pages( array( | |
| 'before' => '<div class="page-link">', | |
| 'after' => '</div>' | |
| ) ); | |
| print "\n" . '</div>'; | |
| } | |
| if ( ! empty( $stickies ) ) { | |
| foreach ( $stickies as $i => $stickies ) { | |
| the_title( '<h2>', '</h2>' ); | |
| } | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment