- This topic has 3 replies, 2 voices, and was last updated 6 years, 2 months ago by
Steve.
Viewing 3 reply threads
-
AuthorPosts
-
-
November 17, 2015 at 10:31 am #5007
bicho44MemberHi:
I made a widget to make a search by taxonomies and i wanna use the onchange, so when the client try to search by one of the values the page, jump to that Taxonomy/Category.
But i dont know how to make this happend or if ther is a piklist way to do it.
My Front page Widget code
<?php /* Title: Buscar por Categoría Class: categoria Width: 300 */ echo $before_widget; echo $before_title; echo $settings['buscar_title']; echo $after_title; $buscadores = $settings['buscarxcategorias']; foreach ($buscadores as $id => $value) { //echo $value; /* Obtengo la data de cada categoría */ $categoria = get_taxonomy($value); if ($categoria) { //piklist::pre($categoria); /* * Para saber el Nombre en Singular * $categoria->labels->name */ piklist('field', array( 'type' => 'select' , 'scope' => 'taxonomy' , 'field' => $value , 'label' => $categoria->labels->name.' de Productos' , 'columns' => '9' , 'choices' => array('' => 'Seleccione para buscar') + piklist( get_terms($value, array('hide_empty' => false)) , array( 'slug' , 'name' ) ) ) ); } } ?> <?php echo $after_widget;If anyone have an idea, i really apreciate 😀
-
November 17, 2015 at 11:33 am #5012
SteveKeymaster@bicho44– The
attributesparameter allows you to pass field attributes:piklist('field', array( 'type' => 'select' ,'scope' => 'taxonomy' ,'field' => $value ,'label' => $categoria->labels->name.' de Productos' ,'columns' => '9' ,'choices' => array('' => 'Seleccione para buscar') + piklist( get_terms($value, array('hide_empty' => false)) , array( 'slug' ,'name' ) ) ) ,'attributes' => array( 'onchange' => 'myFunction()' ) ); -
November 17, 2015 at 2:24 pm #5014
bicho44MemberThaks, amazing
-
November 17, 2015 at 2:25 pm #5015
SteveKeymasterGlad you like it! 😉
Closing ticket.
-
-
AuthorPosts
Viewing 3 reply threads
- The topic ‘Dropdown with onchage’ is closed to new replies.