This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

Isotope Filtering with Custom Taxonomy

  • Creator
    Topic
  • #25216
    Brett
    Participant

    I am setting up several custom post types some of which have their own custom taxonomies. I am trying to set up a page with a post grid with filtering but it looks like the only options to filter by are the built in categories/tags or your portfolio plugin categories/tags. Is it possible to set up a post grid page with filtering using a custom taxonomy without having to custom build something?

Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #25217
    Jason Bobich
    Keymaster

    Hi,

    Yup, it’s possible. I’ll paste the answer I gave on another theme, which applies. You can expand the code to apply to the post grid element, as well.

    From: http://support.themeblvd.com/forums/topic/posts-showcase-filter-by-custom-taxonomy/


    I don’t believe anything needs to be changed within the theme. If you pass through your taxonomy slug, it should work. Passing in your taxonomy slug should just mean making it a selection from the Post Showcase layout builder element, so the correct value can get saved to the element’s options. The Portfolios plugin does this, if you want to use it as an example.

    From your child theme’s functions.php, you’d basically just be doing what the portfolios plugin does here, in order to add your value to the layout builder’s options.

    https://github.com/themeblvd/portfolios/blob/master/tb-portfolios.php#L205

    But knowing that you only want to modify the post_showcase element, you could simplify this to be something more like this:

    function my_elements( $elements ) {
    	$elements['post_showcase']['options']['filter']['options']['topic'] = 'Filtered by topic';
    	return $elements;
    }
    add_filter('themeblvd_elements', 'my_elements');

    Note that the above code is modifying specifically this in the layout builder plugin. Knowing what you’re editing can help you to understand the complex traverse of array within array you see in the code snippet I just wrote.

    This is sort of off the top of my head. Let me know if this doesn’t work.

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.