Custom Content Type Manager
[resolved] Custom search with custom fields (2 posts)

  1. Araminho
    Posted 3 years ago #

    Hi. I want to make a custom search with custom fields. I have 3 questions for that.
    1) How can I get all options of a multiselect field, in order to add that into my search form?
    2) Inside search.php how can I get posts with certain field values?
    3) I am not sure if that is possible, but anyway. Can I get all values of a text field that were inserted in posts? For example, I have "Color" text field, and in different posts some values were inserted - red, blue, black etc. Can I get those values while building the search form?
    I will apreciate any help.


  2. fireproofsocks
    Plugin Contributor

    Posted 3 years ago #

    The short answer here is that custom searches can be hard. Google has spent billions making it look easy, but there are a lot of tricky aspects to searching, especially when you're building filters against your own data model.

    Have a look at the wiki -- I've spent about as much time creating it as I have creating the plugin: https://code.google.com/p/wordpress-custom-content-type-manager/wiki

    1. See https://code.google.com/p/wordpress-custom-content-type-manager/wiki/get_custom_field_meta

    2. The GetPostsQuery class is very flexible (more-so than the WP classes it aims to replace), but it will have some limitations when it comes to repeatable fields. See https://code.google.com/p/wordpress-custom-content-type-manager/wiki/get_posts

    3. See https://code.google.com/p/wordpress-custom-content-type-manager/wiki/get_unique_values_this_custom_field

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic