Change appearance of "sticky" post in WordPress

Ok, Ive developed a theme where basically the posts display the title, the date and category (which is highlighted), the post contents and a read more link… However i have now decided to add an introductory “sticky” post, just an “about me” post which will stay at the top… I know how to make the posts sticky ok, what im wondering though is how i customize this posts appearance compared to all the standard non-sticky posts?

I looked at the html and the sticky post doesn’t seem to have a class or anything that defines it as a sticky post, so can’t just add the class name to the css and give it different rules… I would like this post to only display the title, no date or category or read more link (as the entire post will be displayed), and possibly add a different background colour to this one…

Anyone able to help?

Much appreciated

You can test to see if the post is sticky then load a custom template.

http://codex.wordpress.org/Function_Reference/is_sticky
http://codex.wordpress.org/The_Loop

If you don’t get a more definitive answer within 24 hours, I’ll see what I can do.

You could target the post in CSS by its ID.
If you use Firebug you will see the ID of each post, e.g

article id=“post-274”

Thanks, although im going to need to use the php option as well i think if i only want “content” with this post and not title and no date/category/read more etc…

am i right in thinking the loop should look like this for what i want?

<section id=“posts”>

&lt;?php if (have_posts ()) : ?&gt;
&lt;?php while(have_posts()) : the_post(); ?&gt;

<?php if(is_sticky()):?>
<article id=“sticky_post”><?php the_content(); ?></article>
<?php endif;?>

	&lt;article&gt;
		&lt;h2 class="post_title"&gt;&lt;a href="&lt;?php the_permalink() ?&gt;"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/h2&gt;
				
		&lt;p class="date"&gt;&lt;?php the_time('F jS, Y') ?&gt;&lt;br /&gt;
		Posted in: &lt;?php the_category(', ') ?&gt;&lt;/p&gt;
				
		&lt;div class="grey"&gt;&lt;?php the_content(''); ?&gt;&lt;/div&gt;
				
		&lt;a href="&lt;?php the_permalink() ?&gt;" class="readmore"&gt;Read More...&lt;/a&gt;
	&lt;/article&gt;
		
	&lt;?php endwhile; ?&gt;
		
	&lt;ul id="older_newer"&gt;

		&lt;li id="older"&gt;&lt;?php next_posts_link('Older Posts') ?&gt;&lt;/li&gt;
		&lt;li id="newer"&gt;&lt;?php previous_posts_link('Newer Posts') ?&gt;&lt;/li&gt;

	&lt;/ul&gt;
		
	&lt;?php else : ?&gt;
		
		&lt;h2&gt;Nothing Here!&lt;/h2&gt;
			
	&lt;?php endif; ?&gt;
		
	&lt;/section&gt;

I know that definitely doesnt seem right… jsut want to get some knowledge before i go messing with my theme again… the bold section is the bit with the is_sticky query… what i want is for any “sticky” posts to only display content and with an id which i can target in my css, where the rest of the posts display as shown/formatted (with title, date, category and the read more link)

maybe instead of <?php endif; ?> underneath the sticky post query it should be <?php elseif(!is_sticky()): ?> (ALL THE FORMATTING FOR NON STICKY POSTS) followed by <?php endif; ?>

anyone? help greatly appreciated

YES! got it working with that second option there :slight_smile: starting to really love wordpress development