Created
December 10, 2015 19:10
-
-
Save taniarascia/f222f591ee68ec9ebc57 to your computer and use it in GitHub Desktop.
Apply code to only first post
This file contains 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()) : ?> | |
<?php $post = $posts[0]; $c=0;?> | |
<?php while (have_posts()) : the_post(); ?> | |
<?php $c++; | |
if( $c == 1) :?> | |
<h1>The first post on the main index page</h1> | |
<?php the_title(); ?> | |
<?php the_excerpt(); ?> | |
<?php else :?> | |
<h2><?php the_title(); ?></h2> | |
<?php the_content(); ?> | |
<?php endif;?> | |
<?php endwhile; ?> | |
<!-- page nav --> | |
<?php endif; ?>` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment