Okay
  Public Ticket #3407593
Post grid
Closed

Comments

  • Daniele started the conversation

    In the post grid widget, I'm trying to display a series of custom post types, for example, I'd like a grid with different types of posts that are: articles, projects (custom post type), deals (custom post type). Then I'd like to add a tab filter that allows me to filter the grid based on the type of post using Ajax.

    I've tried using a query ID to filter the query from add_filter and insert the different types of posts as arguments in my widget with the following code, but to no avail. It returns a 500 error. Here's the code:

    //modify the arguments here.

    //widget data is an array with all widget settings

    function modifyMyQuery($args, $widgetData){

        

        $args->set( 'post_type', [ 'alloggio', 'pacchetto', 'attivita' ] );

        return($args);

    }

    add_filter("my_query_additions", "modifyMyQuery",10,2);

  • Daniele replied

    Okay, now I've managed to filter the posts and add customized post types. What I'd like to do next is to have tab filters that allow me to sort the posts as it happens for categories, but I want to filter by post type.

  •  1,175
    Amit replied

    we dont have a filter for post types 

    only the query has a post type 


  • Daniele replied

    So this is everything you have to say? Need some help here, maybe there is a work around for this ? 

  •  1,175
    Amit replied

    I never heard of a filter that filters post types but in the query you can select more than one post type its a multi select field.