Forums

Display first 2 archive posts in separate box followed by remainders as normal (4 posts)

  1. cloudsteph
    Member
    Posted 1 year ago #

    I'd like to display the first 2 archive items differently to the rest on the page in a separate box.

    The code below works fine for getting the different sized post boxes to display but I can't figure out how to wrap the 2 <div class=col-10"> posts in their own separate wrapping container and likewise with the rest of the posts below it.

    [large amount of code moderated as per forum rules - please use the pastebin]

  2. stvwlf
    Member
    Posted 1 year ago #

    post your code to the pastebin as directed and I will take a look

  3. cloudsteph
    Member
    Posted 1 year ago #

    Apologies, my bad for rushing in without reading the regs.

    Posted the code here, any help appreciated: http://wordpress.pastebin.com/yZkF3wtu

  4. stvwlf
    Member
    Posted 1 year ago #

    I would have made two loops. However it can work the way you are doing it with the code I indicated below. I may not have this exactly right but I think you will follow what I am doing. The one part that needs explanation is the closing div on the col-5 wrap. You only want to print that if there is at least one post in the second box so I am testing that count is at least equal to 3 before printing the closing div.

    I also added my code to the bottom of your pastebin URL in case a moderator feels my reply contains too much code.

    [Code moderated as per the Forum Rules.]

Topic Closed

This topic has been closed to new replies.

About this Topic