Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Help with a custom chained filter WordPress


Hi, lads.

I implemented some functionality in one of my clients sites trough a plugin (Category Ajax Chain Select). It's working ok, but I need to add it some more functionality to make it work in some other way.

This plugin helps me filtering results trough a select opction search in a custom taxonomy.

[[LINK href="""]]Here you have the live example[[/LINK]] filtering the custom taxonomy "categorías" in the custom post type "tiendas".
And this is the piece of php I need to use to display it:

<?php chainselect_getcategories( 'categorias', 3, array('Selecciona un estado', 'Selecciona una ciudad', 'Selecciona una colonia'), array('Estado','Ciudad', 'Colonia'), 'Buscar', '') ?>

And here's a short explanation on how to use the plugin: [[LINK href=""]][[/LINK]]

Now I need to add one specific ID of one more custom category (non hierarchical) called "productos" to add one more filter to the query to search in, besides the all ready selected options, the specific ID of the "tag" or custom non hierarchical category called "productos".

This is because my client wants to limited the search just to the stores with that product (Im using the "productos" custom non hierarchical category to groupe the stores with that product in commun)

I know I'll have to manually change the parameters of the php piece of code to match exactly what I want and exclude the id I don't want to query in... it's not a problem, just want it to function so can accept the custom non hierarchical category "productos" .

Off course I'll fill the "productos" taxonomy by my self (since there are more than 800 post to add this taxonomy) I just want to help make make it function and I'll do the boring work...

I can talk to you live or what ever you need to give you more explanations... I figure it's not that hard, it's just that i'm learning PHP and still don't got the knowledge to do it by myself

It's really urgent!


Answers (3)


Arnav Joy answers:

As i can see currently the first dropdown box is "Estado"

so this drop down box lists the taxonomy terms?

then if i choose any value from the first dropdown box then corresponding posts will show at second drop down box "Ciudad" ?

and what is third dropdown "Colonia"

do you want to add new "productos" taxonomy or "term" to the first dropdown box ?

can you answer my these question by clearly specify them.

alejandro Carrillo comments:

Hi, Arnav.

Yes, you are right in wverything, but i want to and the "products" or the specific id of the product taxonomy in a New dorp down below "Estado" "Ciudad" and "Colonia" wich sleects by default the specific Id of the "products" taxonomy in order to and the last filter to the search



Gabriel Reguly answers:

Hola Alejandro,

How about this code?

?php chainselect_getcategories( 'categorias', 4, array('Selecciona un estado', 'Selecciona una ciudad', 'Selecciona una colonia', 'Selecciona un producto'), array('Estado','Ciudad', 'Colonia', 'Producto'), 'Buscar', '') ?>


alejandro Carrillo comments:

Hola, Gabriel.

Gracias, pero no, no funcionó. Si sale el nuevo dropdown con productos, pero no funciona por que no está especificado en el código, <strong>'categorias', 4, array</strong> sólo dice categoría y no productos. Ya intente agregarle ahí productos pero no sirve.

Esto es lo que sale con el pedazo de código que me pasaste: (te lo anexo)