• Resolved comodo

    (@comodo)


    Hi everybody.
    I have created a page with a post custom type (cannabis seed) using Pods plugin. In this page i show many types of seed with with different fields description:

    http://yesweskunk.com/es/vademecum/

    I would like to build a system filter, when i select a type of seed it only show seeds with this type. I am reading Pods documentation and using the object Pods and method filter, but my result is bad. I only get a search form not working.

    I would be very grateful if someone could help me. And sorry my bad english.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Jim True

    (@jimtrue)

    Did you add a Custom Taxonomy for your different types of seeds? If you did, you can use Beautiful Taxonomy Filters or Search & Filter to create filters of your content based on Taxonomy (Seed Type)

    Both require an Archive page to be set for your post type, which is looks like you’ve created at vademecum; this is a list of your posts ‘seeds’, using the default archive.php from WordPress or a custom archive-seeds.php

    Hi again, no. I didn´t add a taxonomy field. Anyway i could “solve” the problem using only jquery and plugin Mixitup. Adding class to every element and filter with this plugin, as you can see, http://yesweskunk.com/es/vademecum/

    Thank you very much. I will take care adding taxonomy field next time 😀

    Plugin Author Jim True

    (@jimtrue)

    That’s actually a really smart solution, especially since you have access to the ‘categorization’ fields and can output them as class attributes. Elegant and smart solution for providing ajax filtering on the front-end!

    Gonna add that to our list 😉

    I am also interested in this kind of filtering. Could you explain your solution more in Detail? What plugin do you exactly mean with Mixitup? Is it possible to use this with taxonomies

    Or is there a better way for live/ajax filtering by taxonomy? Beautiful Taxonomy Filters and Search & Filter always redirect to another page. Also I dont need a submit button or dropdowns. The user should just be able to click on the name of the taxonmy.

    Plugin Author Jim True

    (@jimtrue)

    @cgdannie FacetWP does the filtering you’re talking about on the same page. It is a premium plugin, though.

    https://facetwp.com/

    @cgdannie Mixitup is a javascript plugin or a small javascript library for creatin filters. You have to include this plugin in your theme. After that, you will to create a filter system, each item of this filter will have a class name that must be equals to the class of the elements that you want to show or hide.

    It is a very easy plugin with a good documentation. I am not very good in english and i am not a good programmer, but after 30 minutes reading the documentation i got a “good” solution.

    https://www.kunkalabs.com/tutorials/

    Thank you both very much. I got it to work by adding the taxonomy in the pods template as a class. Then I can insert a pods list with the pods list widget.

    For the filter buttons I then added the following code with the PHP Code Widget on the page (https://de.wordpress.org/plugins/php-code-widget/).

    Is there something I can optimize in this workflow?

    <?php
      define('TAXONOMY', 'my-taxonomy');
      define('CONTAINER_CLASS', 'my-container');
    ?>
    
    <div class="controls">
      <?php
      $taxonomies = get_terms( array(
        'taxonomy' => TAXONOMY,
        'hide_empty' => false,
      ) );
      ?>
      <button type="button" data-filter="all">All</button>
      <?php foreach($taxonomies as $taxonomy): ?>
        <button type="button" data-filter=".<?= $taxonomy->slug ?>"><?= $taxonomy->name ?></button>
      <?php endforeach; ?>
    </div>
    
    <script>
      document.onreadystatechange = function () {
        if (document.readyState == "interactive") {
          var container = document.querySelector(".<?= CONTAINER_CLASS ?>");
          var mixer = mixitup(container);
        }
      }
    </script>
    • This reply was modified 10 months, 1 week ago by  cgdannie.
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Filter Pods’ is closed to new replies.