Nice content, especially including nice usability items like keeping form state after submission. The only ‘problems’ I have with this sort of setup is that, frameworks like laravel have really easy ways using blade to do a similar thing, and when I use WP these days, I generally opt to use twig templates, completely separate out actual php in the ‘view’ so these WP helpers like ‘selected’ & ‘checked’ are not available. But that’s my choice to use that I suppose. Great content videos recently, thank you!
Excellent post and a great solution, but I have a problem, I don't know if this solution works today, the part that is sorted alphabetically or by date, works, but not when I use the checkboxes. I have watched the video several times and I can't find my error, but I have noticed that it doesn't refer to how to filter by the "checkboxes" in the js . What could be my error (I know this is a very broad question)? Thanks
Would be interesting to see how one could use React for the same use case, using of course the headless Wordpress setup... in which the posts (and thumbnails) come from Wordpress using something like GraphQL and our react app filters based on the selection in near real-time (without having to click submit)
Hi! I'm encountering two issues here, one being the fact that my date sorting was already happening Newest to Oldest and got switched back to Oldest to Newest by the JavaScript. The other being that once I load my page, the dropdown is showing a PHP error because I haven't applied any value for "orderby". Any idea why that might be happening?
Hi there , I want to impelement this one , but looking the current Parent Category and bring the child of it, My Code before and was working but without checkbox $terms = wp_get_post_terms( $post->ID, 'product_category'); Any Idea how to make the same with your filter type solution ?
Please make a tutorial on AJAX filtering pots by categories on button click (not checkbox), like a regular portfolio projects filtering. Also ho to make a "Show all" button. Thanx
Hi man thanks for the video, I just changed all "home_type" to "post_tag" that refer to tag parameter but the checkbox didn't work, i don't know why? could you help me please!
I made a custom taxonomy for the post type and added this filter. it works fine. but there is something i want to do. For example, the woocommerce attributes filter shows the filters related to the products in your category. I'm trying to do this in my category.php page. Now, when a category is entered, all filters are listed. is there a way to list only the filters included in that category's posts?
Help? I followed this code and implemented. I am seeing my terms as options. I can select the options and when the page reloads, the options are remembered using checked() however... the posts aren't filtering - I am still seeing everything...
you made it further than me. I see my terms as options, can select the options but nothing happens when i click apply/submit. I'm not seeing any of my posts. Is the code in this index.php supposed to generate the posts somehow or is there other code outputting the cards (image, title, type)?
I am having trouble to load the taxonomies on my custom post type. When I try get_terms([ 'taxonomy' => 'events', 'hide_empty' => false ]); I always get the error "Invalid taxonomy" in the var_dump. Can you maybe post a screenshot of your categories? where did you set the taxonomy "home_type"? Thank you very much
`events` sounds like a custom post type. In my video, `home_type` is a custom taxonomy that is registered with: codex.wordpress.org/Function_Reference/register_taxonomy
@@WPCasts Thank you so much for your answer. I solved the problem by creating a custom taxonomy. Unfortunately now I run into a new problem. The URL for example '?event-type=concerts' doesn't show any filtered results, but still the full range of events. Do I have to activate any settings in the taxonomy registration for that?
Hi, Is this possible to private and restrict term of each individual user from other user in wordpress? so they can not edit , del, etc of other user terms in wordress. Thanks!
Hi, Thank you for your tutorial. I would like to ask if it is possible that when you login as user the articles and post are filter automatically and you can only view the articles or post that allow by administrator? Is that possible? Hope to hear from you soon. Thanks
Helped me a lot! Is there any way to make a taxonomy that automatically refers to the years posts are published and a starting checkbox that takes into account all taxonomies? i.e. All Years / 2020 / 2019 / 2018 All Types / Condo / Single Family / Townhome
It would have to be a custom taxonomy, yes. I would just pre-pend the array with "All X" and when that is selected, you remove it from the query, which will do the same thing.
@@WPCasts Thanks. Expressly i would like to do the thing with custom posts. Firstly i have created php files for each category and then link them by in a static way. Now its clear that its easy to do it by GET attribute. Thanks a lot
@@WPCasts like everyone else, thanks for the walk-thru on this topic! I'm trying to work out how to do the same thing with the default (regular, out of the box) posts. I'm able to create the form with checkboxes but how to output the actual content after clicking apply? It looks like at the start of the video (time stamp around 1:28), that you have your floor plan output code there. thanks again!! cheers
Hello, where did I go wrong. With checkbox name="objectcat[]" All posts are shown. If you remove the brackets and do name="objectcat". This will show the posts of the last selected checkbox.
Then you need to have: hidden field with id="" and name="post_type" or if you want to choice beetwen them - copy solution from select or checkboxes (just remember the 'post_type' parametr. The post type key (slug) you need to set as a value you'll find in url while on WP admin post list screen).
"Oh hi! I didn't see you there!" :)
Can you make a tutorial for creating a search and dropdown filter for custom posts?
Please keep making video for mid level or advance wp dev.
love this one 😍
I didn't know about those check functions for checked and selected. That's cool. Seems better than writing the shorthand conditional. Thanks.
They save a bit of thinking, which is nice. Glad you learned something new!
Thank you! Exactly what I was searching for. Much easier than my current solution
You’re very welcome!
Thank you for your straight forward explanations. Just supported you on Patreon. Can’t wait to see what your next video and courses are.
Thanks Eric, you are awesome!
Nice content, especially including nice usability items like keeping form state after submission. The only ‘problems’ I have with this sort of setup is that, frameworks like laravel have really easy ways using blade to do a similar thing, and when I use WP these days, I generally opt to use twig templates, completely separate out actual php in the ‘view’ so these WP helpers like ‘selected’ & ‘checked’ are not available. But that’s my choice to use that I suppose. Great content videos recently, thank you!
is there a way to do this dynamicall on select change in dropdown or radio without having to click apply button
This is really hepful, thank you!
Most easy way to do that really! Give us more videos please.
Excellent post and a great solution, but I have a problem, I don't know if this solution works today, the part that is sorted alphabetically or by date, works, but not when I use the checkboxes.
I have watched the video several times and I can't find my error, but I have noticed that it doesn't refer to how to filter by the "checkboxes" in the js . What could be my error (I know this is a very broad question)?
Thanks
Nice tutorial dude 👌
Hi this is really helpful. Thank you so much! I was able to implement it immediately. But how do you filter using AJAX?
Excellent content on your channel! Thank you!
Awesome, got yourself a sub
Would be interesting to see how one could use React for the same use case, using of course the headless Wordpress setup... in which the posts (and thumbnails) come from Wordpress using something like GraphQL and our react app filters based on the selection in near real-time (without having to click submit)
Nice!
How did you went into programming interface? It doesn't exist on my end. All I have is blocs for code and short code who doesn't work.
Hi! I'm encountering two issues here, one being the fact that my date sorting was already happening Newest to Oldest and got switched back to Oldest to Newest by the JavaScript. The other being that once I load my page, the dropdown is showing a PHP error because I haven't applied any value for "orderby".
Any idea why that might be happening?
What about Backend Post Filtering? For example to decrypt title and content after retrieve encrypted content from database.
Thanks a lot for the video.
I would like to know which tools did you use to code and how did you connect it to the WordPress?
Did you find your answer? If yes plz tell me too
Thanks for your effort! The only downfall a 404 error when using standard wp pagination.
This is very nice, works for CPT as well and sub categories
Hi there , I want to impelement this one , but looking the current Parent Category and bring the child of it, My Code before and was working but without checkbox $terms = wp_get_post_terms( $post->ID, 'product_category');
Any Idea how to make the same with your filter type solution ?
Please make a tutorial on AJAX filtering pots by categories on button click (not checkbox), like a regular portfolio projects filtering. Also ho to make a "Show all" button. Thanx
Thanks for the tutorial. Can you make a tutorial wordpress with vuejs and graphql? Thank you very much.
The next Headless WordPress video I do will be more Gatsby centric. After that, I'll do one for Vue :)
@@WPCasts Thank you so much. Hope to be a good tutorial for beginners. Because there are a few tutorials like this. I'm following you!
Can this be used to filter by category? Having real problems coding up a button which allows users to sort posts by category.
Hi man thanks for the video, I just changed all "home_type" to "post_tag" that refer to tag parameter but the checkbox didn't work, i don't know why? could you help me please!
What's name of theme you use for VS? Thanks
I made a custom taxonomy for the post type and added this filter. it works fine. but there is something i want to do.
For example, the woocommerce attributes filter shows the filters related to the products in your category.
I'm trying to do this in my category.php page. Now, when a category is entered, all filters are listed. is there a way to list only the filters included in that category's posts?
When your course comes?
Nice content
Help? I followed this code and implemented. I am seeing my terms as options. I can select the options and when the page reloads, the options are remembered using checked() however... the posts aren't filtering - I am still seeing everything...
you made it further than me. I see my terms as options, can select the options but nothing happens when i click apply/submit. I'm not seeing any of my posts. Is the code in this index.php supposed to generate the posts somehow or is there other code outputting the cards (image, title, type)?
If you’re not on flywheel and doing this on a live site which page template is this going to show on?
Классный урок по фильтрации. Спасибо!
You're Welcome!
I am having trouble to load the taxonomies on my custom post type. When I try
get_terms([
'taxonomy' => 'events',
'hide_empty' => false
]);
I always get the error "Invalid taxonomy" in the var_dump. Can you maybe post a screenshot of your categories? where did you set the taxonomy "home_type"?
Thank you very much
`events` sounds like a custom post type. In my video, `home_type` is a custom taxonomy that is registered with: codex.wordpress.org/Function_Reference/register_taxonomy
@@WPCasts Thank you so much for your answer. I solved the problem by creating a custom taxonomy. Unfortunately now I run into a new problem. The URL for example '?event-type=concerts' doesn't show any filtered results, but still the full range of events. Do I have to activate any settings in the taxonomy registration for that?
Ah I found out what the problem is. I am using a custom query to show the results. I need to find a way to apply the URL filter to the custom query
Okay I solved the problem now. I had to add a tax_query to my custom query and set the term to the submitted data
@@schlotterich This is exactly what I am needing to do. Are you able to share your solution with me if possible?
Hello. Mostly, i use tax_query or meta_query for filtering the posts. But this methods are using to much cpu. Can you advice more useful way?
Hi, Is this possible to private and restrict term of each individual user from other user in wordpress? so they can not edit , del, etc of other user terms in wordress.
Thanks!
Hi, Thank you for your tutorial. I would like to ask if it is possible that when you login as user the articles and post are filter automatically and you can only view the articles or post that allow by administrator? Is that possible? Hope to hear from you soon. Thanks
Helped me a lot!
Is there any way to make a taxonomy that automatically refers to the years posts are published and a starting checkbox that takes into account all taxonomies?
i.e.
All Years / 2020 / 2019 / 2018
All Types / Condo / Single Family / Townhome
It would have to be a custom taxonomy, yes. I would just pre-pend the array with "All X" and when that is selected, you remove it from the query, which will do the same thing.
How can I archieve this filter without clicking on apply button, this technique is used on e commerce website
Hi,
How was the custom tax created? what if there is acf?
How can I do that on normal wordpress page instead of index?
i've been looking for a solution to filter posts by category for the last few days and nothing seems to work.
How to add active filter count and display it with close button?
Hello, are these posts Custom Post Types or default post types of WP?
These are custom post types, but you can easily do the same thing with regular posts
@@WPCasts Thanks. Expressly i would like to do the thing with custom posts. Firstly i have created php files for each category and then link them by in a static way. Now its clear that its easy to do it by GET attribute. Thanks a lot
@@WPCasts like everyone else, thanks for the walk-thru on this topic! I'm trying to work out how to do the same thing with the default (regular, out of the box) posts. I'm able to create the form with checkboxes but how to output the actual content after clicking apply? It looks like at the start of the video (time stamp around 1:28), that you have your floor plan output code there. thanks again!! cheers
this isn't working in my case. i get a bunch of errors related to wpml but even when i disable this plugin i never get any posts to list out.
Try disabling the rest of your plugins and try again
You are a mind reader :D
Hello, where did I go wrong. With checkbox name="objectcat[]" All posts are shown. If you remove the brackets and do name="objectcat". This will show the posts of the last selected checkbox.
Hey Mate, do you need to sanitize $_GET keys?
Thanks for sharing
How to apply this filter for search result page in elementor with Last modified & Recently added filter options.
Hii For the AJAX filter for blog post and custom post time check this plugin: wordpress.org/plugins/category-ajax-filter/
Sir, I need your help in troubleshooting my website.
Can you please explain how to make the same for custom post type?
Then you need to have: hidden field with id="" and name="post_type" or if you want to choice beetwen them - copy solution from select or checkboxes (just remember the 'post_type' parametr. The post type key (slug) you need to set as a value you'll find in url while on WP admin post list screen).
What's the name of your vscode theme ?
marketplace.visualstudio.com/items?itemName=taniarascia.new-moon-vscode
@@WPCasts thank you 😊
got it too
It is trending today on r/Wordpress