Displaying sticky in front page of wordpress


<!– sticky post comes here –>
<?php if(is_home()) {
// The Query
$args = array(‘post__in’ => get_option( ‘sticky_posts’ ),
‘ignore_sticky_posts’ => 1);
query_posts( $args );
// The Loop
while ( have_posts() ) : the_post();?>
<div id=”sticky_title”><h1><?php the_title();?></h1></div>
<div id=”sticky_excerpt”><p><?php the_excerpt(); ?></p></div>
<?php
endwhile;
// Reset Query
wp_reset_query();
}
?>
<!– sticky post ends here –>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s