Get Posts by Custom Fields?
-
Is there a way to select posts based on a custom field?
For example, if I’m doing something like this:
$posts = get_posts(‘numberposts=1’);
can I do something like this?
$posts = get_posts(‘numberposts=1&customfield=x‘);
I looked at the get_posts() function and the query_posts() function.
What I want to do is add a custom field to one post called “featured”, set it to 1 on the desired post, and then be able to highlight that post on the hompage.
I also want to be able to select the 9 most recent posts that do not have featured set to 1.
Am I asking the impossible?
- The topic ‘Get Posts by Custom Fields?’ is closed to new replies.