• Hey all,

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

    See here for example: https://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: https://pastebin.com/698866

    Many thanks
    Karl

Viewing 3 replies - 1 through 3 (of 3 total)
  • 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?
    https://ifelse.co.uk/emire/

    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:
    </div>

    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.

    -d

    Thread Starter elyonline

    (@elyonline)

    Hey Guys,
    Thanks for the assistance.
    Karl

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Emphasising first post with CSS. How do I tweak PHPHow?’ is closed to new replies.