Closed bearded-avenger closed 9 years ago
Don't know if I'm following 100% - but why would you need filters if you support custom post types? I think it'd be a neat addition to have the option of adding a filtering system (either by tags or drop down) but I wouldn't think that'd be necessary in order to generally support CPTs.
For instance, I'd like for this to work for the "help-article" custom post type I have running the ThemeBeans FAQ/Help Center, so users don't really need to filter any results (as all of them are help-article CPT posts).
Make sense? Or am I off target here lol?
Rich
hey Rich!
Yep so there's two diff options here:
A. You define the post object type it in the shortcode attribute like type="my-cpt"
. This means that when searching, it will only return results from within that post type.
B. You pass a list of types like type="my-cpt, posts, downloads"
and it will return posts from ALL the post types that you define.
There's pro's and cons with each.
With option A, its limited to searching within a specific post type. With option B, you can search all post types, but a filtering system must exist, or the returned results are separated to show the difference between post types.
I see. Yea I would think pushing an update with option A would be pretty viable with B as a planned secondary update. I'd say searching within a single CPT is more likely going to be the general use case - but that's just a hunch from my experience (no data).
I looked into the cpt search endpoint and believe it or not it already supports it.
Try passing this as a shortcode attribute: type="posts?type=MYTYPE&"
Be sure to leave that &
in place.
I'm not so sure this is exactly user friendly though, so I think I'll update it so that all you have to pass is mytype
. For the time being, this is what you can use though.
just released 0.6 onto wordpress.org with custom post type support
Wow. Awesome stuff boss!
Currently allows for
posts
andpages
but would like to extend to post types. If we extend out to multiple post objects there has to be a visual indicator to the user that they are searching within a specific post object, and that the post objects being returned are of the type they are searching for.A few ideas come to mind for filtering:
Tags
Dropdown
Then the results themselves, ideally, should be somewhat separated by the object types of their search.