- This topic has 12 replies, 2 voices, and was last updated 7 years, 7 months ago by
Steve.
-
AuthorPosts
-
-
July 14, 2014 at 1:24 pm #1992
Dante CervantesMemberHello every one, i have this code
piklist('field',array( 'type' => 'group' ,'field' => 'muni' ,'label' => __('Datos del servicio') ,'position' => 'wrap', 'columns' => 12, 'fields' => array( array( 'type' => 'text', 'field' => 'ubicacion', 'label' => 'Ubicación', 'columns' => 12 ), array( 'type' => 'select' ,'field' => 'muni' ,'label' => 'Seleccione un municipio' ,'columns' => 12 ,'choices' => piklist( get_posts( array( 'numberposts' => 20, 'post_status' => 'any', 'post_type' => 'municipios', 'orderby' => 'DESC' ) ) ,array( 'ID' ,'post_title' ) ), 'attributes' => array( 'cols' => 3, 'rows' => 3 ), ), array( 'type' => 'select', 'field' => 'tipo', 'label' => 'Tipo de Atractivo', 'columns' => 12, 'choices' => array( 'sitio' => 'Sitio Turístico', 'cenote' => 'Cenote / Gruta', 'iglesia' => 'Iglesia / Convento', 'hacienda' => 'Hacienda' ) ) ) ));and i want to filter by “municipio” but how can i ?, im using wp query 🙂
thanks a lot!
-
July 14, 2014 at 1:46 pm #1993
SteveKeymasterWhat do you mean you want to filter by ‘municipio’? On the front end? In your theme?
-
July 14, 2014 at 1:48 pm #1994
Dante CervantesMemberHello Steve, yep in my theme im using this code
$args_sitios = array( 'post_type' => 'sitios', 'posts_per_page' => -1, 'meta_query' => array( array( 'key' => 'muni', 'value' => 68 , 'type' => 'numeric', 'compare' => 'IN' ) ) );but there is no results
-
July 14, 2014 at 2:20 pm #1995
Dante CervantesMemberany one know how can i filter this “group” type of piklist? 🙁
-
July 14, 2014 at 2:28 pm #1996
SteveKeymasterWhat are you trying to accomplish with the field you posted? What is that field supposed to do?
-
July 14, 2014 at 2:30 pm #1997
Dante CervantesMemberi need to filter my cpt by the field named “muni” in the front end with wp query, but i dont know how
-
July 14, 2014 at 2:33 pm #1998
SteveKeymasterIf you look in your database, you will see how the data is saved, which is currently an array and won’t work for you.
Remove the main
fieldparameter and all your data should save individually:piklist('field',array( 'type' => 'group' ,'field' => 'muni' // REMOVE THIS ,'label' => __('Datos del servicio') -
July 14, 2014 at 2:38 pm #1999
Dante CervantesMemberI need to do a search of all posts are within a selectable option element “muni” but piklist is a “group” then, as I do to get the post?
-
July 14, 2014 at 2:39 pm #2000
Dante CervantesMemberthe problem is that I have a very large data base, too many post, then I need to change each and every one of the posts in order to get that, there is a better way?
-
July 14, 2014 at 2:40 pm #2001
SteveKeymastertry the field both ways. Enter data and save, and then check your database. You should see a difference.
-
July 14, 2014 at 2:45 pm #2002
SteveKeymasterUnfortunately, no. Look in the database. Your data is being saved as an array, which you cannot filter. If you want to filter the data you need to remove the
fieldparameter from the main group so each field is saved separately. -
July 14, 2014 at 2:45 pm #2003
Dante CervantesMemberdelete the field, and the information has disappeared, which is not good, if I put the information back field, I guess that’s the structure I had in the beginning, but then it is not no way to do a search with the structure today, and I must change all post? : (
-
July 15, 2014 at 12:20 am #2004
-
-
AuthorPosts
- The topic ‘wp query group field in piklist’ is closed to new replies.