Sometimes, wordpress theme developers or users want to make their latest post looks different from the rest for their theme. Maybe they want to make the font larger, or the background color lighter, or whatever. This can be done by adding new class to the latest post and then styling the class via css. Here, I’ll share the trick to add that new class.
PHP
On standard themes, usually using post_class() function to create post classes. We need a filter so this function on the first post has a special class. Ok, Add the code in the function.php
function firstpost_class($class) { global $post, $posts; if ( is_home() && !is_paged() && ($post == $posts[0]) ) $class[] = 'firstpost'; return $class; } add_filter('post_class', 'firstpost_class');
Comments will be moderated and
rel="nofollow"
will be added to all links. You can wrap your coding with[code][/code]
to make use of built-in syntax highlighter.