• Resolved morfer

    (@morfer)


    Hello I use jetpack portfolio with some categories. On the main portfolio page I use the filter panel with all categories to select. Now I want to show on this page only the posts with a specific category. I want to preselect the filter via a GET parameter in the url.

    So this is my approach via JS:

    function trigger_projekte(type = '') {
        
        if (type != "") {
            
        var filterButton = jQuery('.cbp-filter-item[data-filter*="'+type+'"]');
    
        if (filterButton.length > 0) {
     
          setTimeout(function(){
              filterButton.trigger('click');
          }, 1000);        
    
        }
        }
        
    }  
    
    jQuery(window).on("load", function(){ trigger_projekte("'.$show.'"); });
    
    

    The problem is, that the trigger only works when I have a small amount of posts.

    Is there a possibilty to preselect the filter panel via JS or in PHP?
    Is there maybe another eventlistener I can listen to, for example when all posts are loaded, then fire my function?

    • This topic was modified 5 years, 1 month ago by morfer.
    • This topic was modified 5 years, 1 month ago by morfer.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support supernovia

    (@supernovia)

    Hi there,

    That’s a bit beyond the scope of what we can provide support for here. I recommend hiring someone from https://jetpack.pro/ if you need further assistance with this.

    That said, Jetpack will automatically generate pages for your different project types and tags, so you might be able to look at what’s being done there and modify accordingly.

    Thread Starter morfer

    (@morfer)

    Thanks for the feedback. I know that there a generated pages, but I want to use the main portfolio page with the JS filter panel. The automatic generated pages are useless for this purpose. So is there any eventlistener I can use when all posts are loaded? Thats all I need to know.

    Greetings

    Plugin Support supernovia

    (@supernovia)

    I’m not aware of anything like that, but you’re welcome to search for a similar hook here:
    https://developer.jetpack.com/

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Jetpack Portfolio: How to trigger filter category?’ is closed to new replies.