Support » Themes and Templates » Title size of latest post

  • Resolved daen

    (@daen)


    Hi!
    I cant get this to work;

    I would like to have 1.6em on the TITLE of just the LATEST post, and 1.0em on ALL THE REST.

    were do i find these tags? (h2, changes ALL of them)

    /daen

Viewing 12 replies - 1 through 12 (of 12 total)
  • It depends on what WordPress theme you are using. You can do this easily with the Sandbox theme, as it contains many CSS selectors available to you, such as whether the post is the first one or not.

    I suggest you have a look at the Sandbox theme and try and build your theme around that.

    Only any good if someone wants a 3col theme….

    Daen, you need to provide either the name of the theme you’re using or a link to your site.

    Nope, Sandbox isn’t a 3 column theme. It’s an empty theme with lots of HTML markup designed to make it easy to theme it with CSS with selectors specially designed for doing neat stuff like what daen wants, with just the first h2 with a width of 1.6em but all the rest with a width of 1.0em.

    But yeah, he could just modify the PHP of his existing theme.

    Hmmm. Only “look” I’ve seen on sandbox anywhere so far is 3col.

    No matter, I don’t need stuff like that myself, I code my own…. but if it’s NOT 3col then whoever’s responsible for thumbnailing it should pick something else once in a while.

    IIRC, there were other things I personally didn’t like about it when I first looked at it. Could have changed by now of course.

    And he doesn’t need to mod the “php” of his theme. More likely the css.

    The theme is Kubrick.

    http://www.gunborg.com/wordpress/wordpress/

    I got the title of the first post bigger than the rest, in the early state of editing the css/php files BY accident, but there seems to be no way to change it back.

    Yah, kubrick’s a right PITA to mess with. I can’t help you, I don’t use it at all and have no idea how to change things in it. It’s possibly in the h2 elements in the css, or maybe you input h1 in the post section of index.php. That’s about all I can tell you.

    You might simply take a look through all the neat themes at http://themes.wordpress.net to see if there’s another theme that fits your look – almost all of them there are easier to tweak than kubrick is.

    This can be done, but to get it right we need a clarification. So, when exactly do you want the post title to do this? Only on the home page? How about when we ‘page’ to previous posts?

    Anyway, here’s a bit of code to hit the basics of this request:

    1. In the default theme’s template(s) (mainly we want index.php), modify the post title line to:

    <h2<?php if($post == $posts[0]) echo ' class="first-post"'; ?>><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>

    In the stylesheet (style.css), add:

    .first-post {
    font-size: 1.6em;
    }

    This is what I would like to have;

    Only the titel of the newest post should be bigger.
    And only on the homepage, no other place.

    Then try this:

    <h2<?php if( is_home() && (get_query_var('paged') <= 1) && ($post == $posts[0]) ) echo ' class="first-post"'; ?>><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>

    The PHP code buried in the <h2> tag tests for the home page, for 1 or no value in the ‘paged’ query variable (i.e. a posts pagination value that shows us on the very first page), and the current post equals the first one in the $posts object. If all of these evaluate to true, it adds class="first-post" to the tag.

    Thanks! Worked great! 🙂

    Mark this resolved up top, then, please and thanks?

    vkaryl. Please gige me ATLEAST 1 MIN, thank you 😉

    daen: Posted: 2006-11-15 01:48:09
    vkaryl: Posted: 2006-11-15 01:48:54

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Title size of latest post’ is closed to new replies.