• This plugin doesn’t appear to support SearchWP queries – https://searchwp.com/documentation/classes/searchwp-query/

    At the moment we’re forking this plugin, and adding the following case to the switch in get_pagination_args():

    case 'swp':
    // SWP_Query
    $posts_per_page = intval( $query->posts_per_page );
    $paged = max( 1, absint( $query->paged ) );
    $total_pages = max( 1, absint( $query->max_num_pages ) );
    break;

    Might it be possible to add this, so we don’t have to manually update our forked plugin? Or maybe even add a hook here to support custom query types (like SearchWP)?

Viewing 1 replies (of 1 total)
  • Thread Starter Steve Taylor

    (@gyrus)

    FYI, for now we’ve implemented an extension to the SWP_Query class which replicates the functionality of WP_Query->get(), in our custom theme code:

    class Biro_SWP_Query extends SWP_Query {

    function __construct( $args = [] ) {
    parent::__construct( $args );
    }

    public function get( $query_var, $default_value = '' ) {
    return isset( $this->{$query_var} ) ? $this->{$query_var} : $default_value;
    }

    }

    This works for us, but I wonder if adding explicit support for SearchWP might help others who can’t do this?

Viewing 1 replies (of 1 total)

The topic ‘SearchWP support’ is closed to new replies.