custom search form to filter pods with ajax
Hi guys,
I'm a beginner in wordpress and Pods. Thanks for this great plugin.
I would like to know if it's possible to access pod items from php script if its not a template ??? What I want to do is to make my own searchform in my wp template and then call a php file with ajax in order to select the pods i need and display them witout reload the page.
So, in my searchform.php, when i try to do a new Pod like this :
$pods = new Pod('actus'); the class is not found.
I think its because i'm not in WP template.
Am I something wrong or if its not possible is there any other way to do it ??
To resume i want to filter my pods with three checkboxes "dog", "cat" and "monkey". If the monkey and the cat are checked. I want to hide all dog's pods from my page.
Im struggling with this, I hope someone can give me hand.
Many thanks
4 Answers
Why won't you put the php code IN the template and don't worry about the function anymore ?
On the other hand, if you want to use an external file and still want to call upon wp, you can still do this: require('path-to-location-of/wp-blog-header.php');
all functions you can call in wp or pods templates can be called upon now too.
That's why I said I'm a beginner :) !! Thanks it works !!
If you want to use Pod Class, you just need to make sure that you get the header !! (wp-blog-header.php)
Thank you very much for this !!
no problem, glad I could help. Tom.
You can also add special attribute/class to all cat/monkey/dog html wrappers and then show or hide them using simple javascript, this makes another server request unnecessary.


