• I’m using a plugin to display team members (GS Team) – ReOrder plugin works great to reorder the team members in here when using a standard grid layout, however when I change the layout to have a filter then it loses all the order and reverts back to the previous order.

    How can I get this to work when a filter is being used?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Aurovrata Venet

    (@aurovrata)

    How can I get this to work when a filter is being used?

    can you explain you mean by a filter? Does it uses hooks to implement the results? What about the actual post query, how is that handled?

    Thread Starter xxhann

    (@xxhann)

    So here is the filter i’m using which is breaking the posts up into categories just to give an idea of the filter see image (https://tinypic.host/image/bAWx5)

    This seems to be the code that being used to set the order if this helps

    function get_query($atts) {
    
        $args = shortcode_atts([
            'order'                => 'DESC',
            'orderby'            => 'date',
            'posts_per_page'    => -1,
            'paged'             => 1,
            'tax_query'         => [],
        ], $atts);
    
        $args['post_type'] = 'gs_team';
    
        return new \WP_Query(apply_filters('gs_team_wp_query_args', $args));
    }
    
    • This reply was modified 2 years, 5 months ago by xxhann.
    Plugin Author Aurovrata Venet

    (@aurovrata)

    you’re using an 'orderby' directive. The plugin will no rank your posts unless you’re overriding the oderby which you can either check in the ReOrder page or programmatically set with a filter, see faq #10 section 2

    Thread Starter xxhann

    (@xxhann)

    Thanks, but I have been playing around with this and it’s not seeming to make any difference. This is what i’ve currently got:

    add_filter('rpwc2_allow_custom_sort_orderby_override', 'override_orderby_sorting', 10, 5);
    
    function override_orderby_sorting($override, $wp_query, $taxonomy, $term_id, $type) {
        
        if ($wp_query->get('post_type') === 'gs_team' && $wp_query->is_main_query()) {
            $override = true;
        }
        return $override;
    }
    
    Plugin Author Aurovrata Venet

    (@aurovrata)

    is the line

    $override = true;

    actually being executed? I am not sure $wp_query->is_main_query() will be true for your custom query

    Plugin Author Aurovrata Venet

    (@aurovrata)

    also, is the filter 'gs_team_wp_query_args' being used by a function? If so what other args are passed into the query? You should make sure suppress_filters is set to false, it is by default, but if a plugin/function sets it to true then the reorder plugin functionality will never be invoked.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Filtered posts’ is closed to new replies.