I know that we can tweak the font-size of post titles using style.css file in wordpress, but doing that affects all posts. My question is how to do it to an individual post, without affecting the other posts' settings. To be precise, I'd like to know how I can show my latest post's title bigger while retaining others as they are. As I'm showing only my latest post in full, I want its title to be bigger and prominent than the rest. Can somebody tell me the hack to show only my first (latest) post with a larger title?
Use a conditional statement to add a class to the heading of the first post: <?php if ( !is_paged() && ($post == $posts[0]) ) ?> <h2 class="firstpost"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2> <?php else : ?> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2> <?php endif; ?> Code (markup): Add this to the stylesheet: .firstpost { font-size: 20px; } Code (markup): It only applies the style on the first page, not on pages after that. If you want it on every page, remove the !is_paged() && bit. Hope that works, I haven't tested it.
You can also use <b><em><i> ( and the corresponding closing tags) right in the title to tweak the on page appearance.
Unfortunately, Wordpress is not that simple. It has a PHP loop that adds the markup for each post. Applying a style to it affects all the posts, unless there is also code to select certain posts.
Thanks for the response. What should I substitute the above code for? I used it in place of this: <?php if ($postcount == 1 && !is_paged()) : ?> <?php the_content(__('Read more'));?><div style="clear:both;"></div> <?php else : ?> <?php the_excerpt(); ?> <?php endif; ?> And the site went blank. I haven't learned CSS/PHP - so I can implement what you say only if you explain how to do it exactly. Here's the my home page's code (Index.php) if you like to have a look: http://pastebin.com/HNGaXcJJ
Nope, that didn't fix it either. I raised the same issue on WordPress forums and the moderator suggested a different hack which looked like it would fix it, but it altered the body of the post instead of the title. See if you can figure out something around it to make things work, here.