Viewing 5 reply threads
  • Author
    Posts
    • #5032
      bicho44
      Member

      Hi again:

      I made the change in my other ticket and is almost ok.

      I need the dropdown jump to the taxonomy URL like demo.com/product/[taxonomy-name], but its seems i cannot make the function work.

      There’s a WP function who have an example to make this, but do not respect my url settings (use the /?cat=xxx)

      Any idea?

      Thanks in advance.

    • #5040
      Steve
      Keymaster

      So you’re not using pretty permalinks? You’re using query parameters? What’s your settings in SETTINGS > PERMALINKS?

    • #5043
      bicho44
      Member

      Of course im using pretty permalinks 😀

      But, the form with get, do not use it, i was trying to change that, and then i give u and ask for help 😀
      This is my front end code, right now (im not using piklist here, because it wasn’t working)
      Also i need the form tag. is my second try 😀

       if ($categoria) {
      
             // piklist::pre($categoria);
              $catname= strtolower($categoria->labels->name)
      ?>
          <form id="<?php echo $catname; ?>-select" class="<?php echo $catname; ?>-select" action="<?php echo esc_url( home_url( '/productos/') ); ?>" method="get">
      
          <?php
          $args = array(
              'show_option_none' => __( 'Seleccione para Buscar', 'imgd' ),
              'show_count'       => 0,
              'orderby'          => 'name',
              'name'             => $catname,
              'echo'             => 0,
              'value_field'      => 'slug',
              'taxonomy'         => $categoria->name,
          );
          ?>
      
          <?php $select  = wp_dropdown_categories( $args ); ?>
          <?php $replace = "<select$1 onchange='return this.form.submit()'>"; ?>
          <?php $select  = preg_replace( '#<select([^>]*)>#', $replace, $select ); ?>
              <h4><?php echo $categoria->labels->name; ?> de Productos</h4>
      
          <?php echo $select; ?>
      
          <noscript>
              <input type="submit" value="Buscar"  class="btn btn-success"/>
          </noscript>
      
          </form>
      
          <?php    } ?>

      The form send a get request, and because of the `’return this.form.submit()’ send the ‘name’ arg as variable with the ‘slug’ as value to search.
      As i said i need to send a get request with the form of the taxonomies Ex: /productos/linea/Gastroenterología but i dont know how.
      Also i wanna use the piklist way, but the dropdown in the widget, dont have the form tag,
      PS: I have 3 dropdowns in the widget at the same time, each for every kind of taxonomy.

      Attachments:
      You must be logged in to view attached files.
    • #5049
      Steve
      Keymaster

      Sorry, I’m a bit confused. Does it work this way, but not with Piklist? Or it doesn’t work either way?

    • #5051
      bicho44
      Member

      Its dosent work either way…

      Sorry if i wasnt clear.

      Thanks in adavnce, im still trying

    • #5067
      Steve
      Keymaster

      Get it working the way you want with standard HTML, and then we’ll make it work with Piklist.

Viewing 5 reply threads
  • You must be logged in to reply to this topic.