Support

Account

Home Forums General Issues Filter pages by custom field

Helping

Filter pages by custom field

  • Hi there,

    I’ve a question about filtering pages by a custom field. I’ve made a custom select field with a list of countries. What I’m trying to do is showing some pages only in specific countries. For example, if on a page the custom select field “France” is selected, I would like to show this page only if a person enters the site from France. I can figure out how to get this variable from the users side, but I can’t figure out if it’s possible to filter the pages before showing up in the frontend by a custom field., maybe with a specific function inside functions.php?

    Hopefully somebody knows how to do this. Thank you in advance!

    Kind regards, Robin

  • Hi @robinw

    Querying posts based on custom field values:
    http://www.advancedcustomfields.com/resources/how-to/how-to-query-posts-filtered-by-custom-field-values/

    Hoe to allow a user to select the filter?
    Simple, just use a $_GET parameter in the URL to set the custom field value!

    Thanks
    E

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Filter pages by custom field’ is closed to new replies.