WordPress.org

Forums

How to Change Title Font Size Specifically? (5 posts)

  1. alok2010
    Member
    Posted 4 years ago #

    I know that we can tweak the title font size using style.css file in wordpress, but that affects the titles of all the posts. My question is how to do it specifically, without affecting the rest of the posts.

    To be precise, I would like to know how I can display my latest post's title prominently while retaining others as they are.
    I'm showing only my newest post in full (using this hack) so I want its title to be bigger and prominent.

    Can somebody tell me the hack for showing only my first (latest) post with a larger title?

  2. Inv_Trdr
    Member
    Posted 4 years ago #

    That is controlled in the post.php and style.css files. So not sure if you can change it individually.

  3. Rev. Voodoo
    Volunteer Moderator
    Posted 4 years ago #

    lol...how good is your php? cuz mine is terrible! I have a concept for you, maybe you can piece it together.....or someone can come along and help you out.

    I use the bit of code below to alternate adding a class of odd or even to each post. That way in css I can change things up based on whether the post class is odd or even. Now I know that's not what you want to do.....but this code is based on a counter, and the bit of code you used is too. If ya can figger a way to piece together your code with some of this, you could assign a class to your first post, then be able to style anything you want in it differently

    <?php if (have_posts()) : ?>
             <?php
             $c = 0; // set up a counter so we know which post we're currently showing
             $extra_class = 'even' // set up a variable to hold an extra CSS class
             ?>
             <?php while (have_posts()) : the_post(); ?>
             <?php
             $c++; // increment the counter
             if( $c % 2 != 0) {
    	  // we're on an odd post
    	   $extra_class = 'odd';
             } else {
             $extra_class = 'even'; }
             ?>
    
             <div id="post-<?php the_ID(); ?>" <?php post_class($extra_class) ?>>
  4. alok2010
    Member
    Posted 4 years ago #

    My knowledge of PHP is zero and I can't help myself with what you said. :(

    I hope somebody simplifies it for me, or comes up with something rather clear-cut. Thanks for the reply, appreciated.

  5. alok2010
    Member
    Posted 4 years ago #

    Does nobody here know how to do it?

Topic Closed

This topic has been closed to new replies.

About this Topic