Forums › Forums › Search & Filter Pro › Custom post type not showing in "post type" search form UI checkboxes
- This topic has 21 replies, 3 voices, and was last updated 5 years, 4 months ago by Anonymous.
-
Ross Moderator(Private) August 14, 2019 at 10:55 am #218958
Hi again.
So the absolute easiest way to do this, is perform a search, and then look at the URL:
mysite.com/?sf_myoption=myvalue
Then you can link to this URL from your navigation or wherever you are using a link to the search page, with the URL value in there.
Because you’ve removed the first option too, the search form can appear within the site without the worry of an option not being selected before being used.
There is another more tedious way of modifying the query with another filter – though, we’re improving this for v3 (our next major release) so the above option might be simpler for now.
Let me know your thoughts.
Thanks
Ross Moderator(Private) August 14, 2019 at 12:21 pm #218979Ahhh yes fair enough, if it wasn’t the homepage the above should have worked, but in this scenario I can see why that wouldn’t.
Anyway, I’ve had a little play with some code and this is working for me (where your homepage page ID is
2
) – add this in addition to the code before:add_action("init", "wp_init"); function wp_init(){ //make sure this the homepage only, you might need to adapt this (start by removing if this is not working) if(is_page(2)){ //if post types is not set, set it to 'post; if(!isset($_GET['post_types'])){ $_GET['post_types'] = 'post'; } } }
It’s a little hacky but seems to work just fine in my testing.
Thanks
-
AuthorPosts