shake1 (@shake1)

Forum Replies Created

Viewing 1 replies (of 1 total)
  • In reply to: Customize Shortcodes

    shake1
    Participant

    @shake1

    I made the following because of an error, does it look ok?

    
    function filter_bbp_get_view_query_args( $args, $view ) {
        // Check if the view exists
        if ( function_exists( 'bbp_get_view' ) ) {
            if ( ! bbp_get_view( $view ) ) {
                return new WP_Error( 'invalid_view', __( 'Invalid view specified.', 'bbpress' ), $view );
            }
        }
    
        if ( 'popular' === $view ) {
            $args['date_query'] = array(
                array(
                    'after' => '1 week ago',
                ),
            );
        }
        return $args;
    }
    add_filter( 'bbp_get_view_query_args', 'filter_bbp_get_view_query_args', 10, 2 );
    
    
Viewing 1 replies (of 1 total)