Support » Fixing WordPress » How to get posts by more than one custom field?

  • Hi!
    I`m building a wordpress theme for a website which will actually feature two website. One for a radio station and one for an online newspaper.
    On the frontpage I want to display certain important posts, based on one or two custom fields.
    I`m using the query_posts() function to display articles filtered by only one custom field.

    <?php query_posts('meta_key=field-name&meta_value=field-value'); ?>

    But my problem is that this method only accepts one custom field as a filter. I have a few sections where I need to filter articles by two custom fields.
    How can I achieve this?
    Do I need to add a new function to my theme`s functions.php file, or directly from the loop?

    [ Please do not bump, it’s not permitted here. ]

  • The topic ‘How to get posts by more than one custom field?’ is closed to new replies.