Last active
December 13, 2015 17:58
-
-
Save aahan/4951918 to your computer and use it in GitHub Desktop.
Adds a custom class for the first post, on the first page of index and archive pages.
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( $wp_query->current_post == 0 && !is_paged() ) { | |
post_class('first-post'); | |
} else { | |
post_class(); | |
} | |
?> | |
<? // The same code in a single line ?> | |
<?php if( $wp_query->current_post == 0 && !is_paged() ) { post_class('first-post'); } else { post_class(); } ?> | |
LOOP COUNTER | |
<section id="the-big-stories"> | |
<?php $the_big_stories = new WP_Query('tag=highlights&showposts=3'); ?> | |
<?php if ( $the_big_stories->have_posts() ) : ?> | |
<?php while ($the_big_stories->have_posts()) : $the_big_stories->the_post(); $the_big_story_counter++; ?> | |
<article id="big-story-<?php echo $the_big_story_counter; ?>"> | |
<?php //the_post_thumbnail( 'the_big_stories_thumb' ); ?> | |
<div><img src="http://placehold.it/440x248"></div> | |
<h1 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'doraemon' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h1> | |
</article> | |
<?php endwhile; ?> | |
<?php else : ?> | |
<?php get_template_part( 'no-results', 'index' ); ?> | |
<?php endif; ?> | |
</section><!-- #content .site-content --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment