Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #213438

    Is it possible to add a filter to sort the portfolio grid by menu order?

    I tried the following and it did not work

    /* Changes portfolio grip to sort by menu */
    add_filter( ‘avia_portfolio_grid_query’, ‘avia_portfolio_grid_query’, 10, 2);
    function avia_portfolio_grid_query( $query, $params ) {
    $query[‘orderby’] = ‘title’;
    $query[‘order’] = ‘ASC’;
    return $query;
    }

    #213690

    Hi Arron!

    I tested this code locally, it worked:

    function custom_post_grid_query( $query, $params ) {
    $query['orderby'] = 'title';
    $query['order'] = 'ASC';
    return $query;
    }

    Remember that it will take the Title, not the slug.

    If it doesn’t work please provide us with an administrator account so we can take a look.

    Best regards,
    Josue

    #213698

    Thanks so what would the add filter look like?

    add_filter( ‘avia_portfolio_grid_query’, ‘custom_post_grid_query’, 10, 2);

    #213714

    Hey!

    You can use this:

    add_filter('avia_post_grid_query', 'avf_custom_post_grid_query');
    
    function avf_custom_post_grid_query ( $query ) {
    $query['orderby'] = 'rand';
    return $query;
    }
    

    Best regards,
    Ismael

    #213814

    That worked…thanks…great support

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘add Filter to sort Portfolio Grid by custom sort’ is closed to new replies.