WordPress.org

Ready to get started?Download WordPress

Forums

Making a customised front page using categories (4 posts)

  1. Haarball
    Member
    Posted 7 years ago #

    Here's the deal:

    I'd like a front page where I've got two or three columns that each contain posts from a specific category. I'd like to have the first post in each column/category as a title and excerpt, and the following (5-10, I guess) as just the titles/links. This isn't exactly what WordPress was built for, but is it still easily done? It's basically a mini-version of the categories archive displayed one the front page, but I guess it involved a bit of tweaking. How would I go about doing this?

    Thanks a million in advance to anyone who will bother to help me out with this.

    I've browsed around to see if a solution to this has already been posted, but I couldn't find anything comprehensive enough. I know a bit about how WordPress works, but not quite enough. I've been looking into using Drupal or Joomla or something similar, but I'm thinking that's overkill.

  2. klklaser
    Member
    Posted 7 years ago #

    I believe you want to restrict the loop. Keep in mind the "!" before a function logically means "not" or "not this". Here's another set of references. Follow the links on those pages, I think it's all there.

  3. Haarball
    Member
    Posted 7 years ago #

    Ah, of course, I didn't think of that. Thanks. I used filosofo's function, which worked brilliantly, but I don't know how I can modify it to make it possible to use it several times on the same page.

    Also, is there an easy way of displaying the latest posts from a certain category excluding the most recent one? (as I described above)

  4. klklaser
    Member
    Posted 7 years ago #

    It occurred to me that what you need is a mini-loop within the loop. My thought was that if you used another "for" loop, and incremented a variable, you could assign the last post a specific variable (perhaps 0), and not have any printing functions in that mini-loop. All other numbered variables would print. I'm not certain php supports for-next with variable creation, or not. (another thing to search for!)

    Then, it occurred to me to search for whether anyone had done that already, and with the proper keywords, I found this. It seems the "offset" thing (whatever it's called) might be adaptable.

    The Template Tags page, referenced on the above page, appears to have what you're looking for.

    Good luck!

Topic Closed

This topic has been closed to new replies.

About this Topic