Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I make my custom connector compatible? #6

Open
bruno-barros opened this issue Jul 3, 2020 · 2 comments
Open

How do I make my custom connector compatible? #6

bruno-barros opened this issue Jul 3, 2020 · 2 comments

Comments

@bruno-barros
Copy link

I'm implementing a custom connector to read data from tables that are not from default WP tables.
I'm getting the data, but I have no clue on how to pass propper data to do offset pagination.
Can you give me a tip?
Thanks

@bruno-barros
Copy link
Author

hummm seems to be impossible. I have may own class to query results. If you allow any class with a XYZ method to retrieve the total would be awesome.

        $total = null;

        if ($query instanceof \WP_Query) {
            $total = $query->found_posts;
        } elseif ($query instanceof \WP_User_Query) {
            $total = $query->total_users;
        }

@bruno-barros
Copy link
Author

This way it works.

        if ($query instanceof \WP_Query) {
            $total = $query->found_posts;
        } elseif ($query instanceof \WP_User_Query) {
            $total = $query->total_users;
        } else if(method_exists($resolver, 'get_total_records')){
            $total = $resolver->get_total_records();
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant