The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Working on a 'Featured' section (3 posts)

  1. heriz
    Posted 6 years ago #

    I'd like to create a 'featured' box on my home page that works like this:

    If there is a post in both its own category AND the 'featured' category, show it. When only in its own category, don't show it.

    If there are NO posts in the 'Featured' category, show latest post from categories x,y,z.

    I was looking at using query_posts(array('category__and' => array(x,featured))); but it needs to be (x,featured)(y,featured)(z,featured) etc to include all possible combinations, which isn't very elegant or futureproof.

    Using conditional 'if' statements looks like the way, but I'm not sure which functions to use or how to use them

    Can anyone guide me a little on this? Is there a simple way of doing it that I've overlooked?

  2. heriz
    Posted 6 years ago #

    NB, this could be achieved using the 'sticky' or 'announcement' features, but I have an events section which conflicts with these, for some reason I don't entirely understand.

    The idea is that if we want an important post to remain on the front page for longer, while continuing to post - we simply place it in the 'featured' category (AS WELL AS the normal category) for as long as needed.

    I may be describing a well known technique, but I've not seen it mentioned before.

  3. heriz
    Posted 6 years ago #


Topic Closed

This topic has been closed to new replies.

About this Topic