custom search form to filter pods with ajax

0

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

asked Oct 22 '10 at 12:40

lromain

1

add comment
enter at least 15 characters

4 Answers

0

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.

answered Oct 22 '10 at 5:47

tomhermans

36

add comment
enter at least 15 characters
0

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 !!

answered Oct 23 '10 at 6:55

lromain

1

add comment
enter at least 15 characters
0

no problem, glad I could help. Tom.

answered Oct 23 '10 at 9:48

tomhermans

36

add comment
enter at least 15 characters
0

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.

answered Oct 24 '10 at 6:14

Fike

208

add comment
enter at least 15 characters