Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End WP: Can you use a Custom Field to "tag" a Post as Featured?

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #28668
    TSG
    Member

    Hi all,

    First post so please be gentle, my Google skills appear to be lacking tonight :o

    There’s a raft of plugins for Featured Posts but I’d rather avoid installing yet another plugin if I can help it. Some of the solutions I’ve looked at also work by putting posts into a specific category which as I understand it, is not best practice (posts should only have one category)? I’m wondering if there’s a way to indicate a post as featured with a custom field set to true or false by the (non-tech) post author? I’m no PHP programmer so I’d be grateful for a solid example of code if it’s practical. My ultimate aim is to wrap that loop into a div and use the jQuery Galleryview or similar to make a content slider out of it.

    Here’s what I currently have if it helps:

    Code:

    #73746
    TheDoc
    Member

    You should definitely be using Categories for this.

    I’m not sure who told you posts should only have one category. Posts can have, and are perfectly suitable to have, as many categories as you like.

    For example, if you had a review for the movie "Zombieland", you could have the following categories:

    Horror, Comedy, Reviews

    There is certainly nothing wrong with that. Click "horror" to see all the other things tagged with that, same for "comedy". Click "reviews" to see all of your other reviews. If it’s a site that also reviews TV Shows and Books, you could even have a 4th category applied to it called "Movie", so people could see all of the movies you’ve written about.

    All in all, this is what the categories function is meant for, to both differentiate and group posts together. Using custom fields would seem quite backwards in this case.

    #73747
    TSG
    Member

    Thanks for the quick reply – Categories definitely simplifies things, all I have to do is change that category value and I’m done. I don’t have the source for the "only one category" advice but it was most likely some SEO blog. It annoyed me at the time as I’ve used multiple categories on my own blog for years lol.

    Regards, Karl

    #73876
    Chris Coyier
    Keymaster

    You absolutely can do a query for posts which contain a specific custom field and specific value of that custom field though…

    It’s like meta_key=whatever&meta_value=whatever as part of the query string

    #73434
    TheDoc
    Member

    Is there any reason why you would think to do that instead of using categories though?

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘Back End’ is closed to new topics and replies.