• 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 display my latest post’s title bigger while retaining others as they are.
    As I’m showing only my latest post in full (using this hack), 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?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Change:

    <?php if ($postcount == 1 && !is_paged()) : ?>
       <?php the_content(__('Read more'));?><div style="clear:both;"></div>
    <?php else : ?>
       <?php the_excerpt(); ?>
    <?php endif; ?>

    to:

    <?php if ($postcount == 1 && !is_paged()) : ?>
       <div class="latest"><?php the_content(__('Read more'));?></div><div style="clear:both;"></div>
    <?php else : ?>
       <?php the_excerpt(); ?>
    <?php endif; ?>

    and then style on the new .latest class.

    Thread Starter alok2010

    (@alok2010)

    I changed it. Now I don’t know CSS that well…where and what exactly should I add if I only need to change the font-size to say 25px?

    Thread Starter alok2010

    (@alok2010)

    I tried adding this to my stylesheet;-

    .latest { font-size: 25px; }

    It changed the font-size of the body, not the title.

    How to do it right?

    What html tag is being used on the titles? For example, if it was H2, then you’d use:

    .latest h2 {font-size:25px;}

    Thread Starter alok2010

    (@alok2010)

    It’s h2, but adding that didn’t work. I even tried h1 and h3, which didn’t work out either.

    Did you remember to press CTRL and F5 simultaneously when viewing the updated page. Or try emptying your browser cache? This should ensure that your web browser fetches a fresh copy of the page rather than serving up an out-dated copy from your own cache.

    Thread Starter alok2010

    (@alok2010)

    I did that, it didn’t make any difference. Anything else we can do about it? Here’s my Main Index Template (index.php) if you like to have a look:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    Thread Starter alok2010

    (@alok2010)

    Sorry, didn’t know that the forum doesn’t allow long codes. Here’s it: https://pastebin.com/LJWEhEKK

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘How to Tweak the Title Font-size for an Individual Post?’ is closed to new replies.