Emphasising first post with CSS. How do I tweak PHPHow? (4 posts)

  1. elyonline
    Posted 9 years ago #

    Hey all,

    I have seen quite a few blog sites recently that emphasise the first post on the website.

    See here for example: http://bartelme.at/

    I know how to style the CSS but am unmsure what I would need to do with my PHP code to seperate 1st post from the other posts.

    Does anyone have any suggestions?

    This is my home.php source: http://pastebin.com/698866

    Many thanks

  2. Mark (podz)
    Support Maven
    Posted 9 years ago #

    I don't have the answer, but Phu has written the Emire theme which has the same principle and might be a good place to start? Might help?

  3. davidchait
    Posted 9 years ago #

    weird theme code... you don't have any DIV wrappering the post output, which most themes do.

    quick hack is to wrap the entire post block with a div. The line that starts:
    <h3 class="wp" id="post-<?php the_ID(); ?>">...
    insert before it:
    <div class="postwrap" id="postcount-<?php echo $i; ?>">

    Then, on the blank line after the close of the content (line 30 in the pastebin), add:

    From there, it's all CSS. ".postwrap" is around any 'upper' posts, and "#postcount-1" is the first post.

    That's just one of many ways to do it. You could also conditionally add that div stuff only when $i==1, and hardcode the id to 'firstpost' or something like that.


  4. elyonline
    Posted 9 years ago #

    Hey Guys,
    Thanks for the assistance.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.