WordPress.org

Ready to get started?Download WordPress

Forums

Paging hack (2 posts)

  1. Dystopia777
    Member
    Posted 6 years ago #

    Hey,

    I'm having a go at writing a simple plugin that lists rows from a table in a page available from within the admin area. I have created the table myself.

    I wanted to know if there was a built in way of paging result sets, 10 per page or whatever. I've had a look at the wpdb object and the documentation for wp-query. As far as I can tell wp-query is for use with pre-existing data structures such as a posts?

    Is there an advisable method or facility within the source code that allows record paging for custom sql? or must I hack something together myself?

    Any help appreciated!!

  2. Kafkaesqui

    Posted 6 years ago #

    Otto gave you an example of how to handle pagination through a custom query in your other thread. See here for how you might collect the 'page' # you're presently on:

    http://wordpress.org/support/topic/57912#post-312858

    Along with that, the 'posts per page' value is available through:

    get_query_var('posts_per_page')

Topic Closed

This topic has been closed to new replies.

About this Topic