- This topic is empty.
-
AuthorPosts
-
April 8, 2010 at 4:10 pm #28668
TSG
MemberHi 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:April 8, 2010 at 4:17 pm #73746TheDoc
MemberYou 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.
April 8, 2010 at 4:26 pm #73747TSG
MemberThanks 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
April 10, 2010 at 8:13 am #73876Chris Coyier
KeymasterYou 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
April 10, 2010 at 1:52 pm #73434TheDoc
MemberIs there any reason why you would think to do that instead of using categories though?
AuthorPostsViewing 5 posts - 1 through 5 (of 5 total)- The forum ‘Back End’ is closed to new topics and replies.