コード例 #1
0
 /**
  * Load all of our data
  *
  * @access      public
  * @since       1.0
  * @return      void
  */
 function prepare_items()
 {
     /**
      * First, lets decide how many records per page to show
      */
     $per_page = 20;
     $paged = isset($_GET['paged']) ? absint($_GET['paged']) : 1;
     $columns = $this->get_columns();
     $hidden = array();
     // no hidden columns
     $this->_column_headers = array($columns, $hidden, array());
     $this->process_bulk_action();
     $meta_query = array();
     if (isset($_GET['user'])) {
         $meta_query[] = array('key' => '_wp_log_user_id', 'value' => absint($_GET['user']));
     }
     $this->items = WP_Logging::get_connected_logs(array('log_type' => 'gateway_error', 'paged' => $paged, 'posts_per_page' => $per_page, 'meta_query' => $meta_query));
     $current_page = $this->get_pagenum();
     $total_items = WP_Logging::get_log_count(0, 'gateway_error', $meta_query);
     $this->set_pagination_args(array('total_items' => $total_items, 'per_page' => $per_page, 'total_pages' => ceil($total_items / $per_page)));
 }
コード例 #2
0
    function print_pagination($current = 1)
    {
        ?>
		<div class="ctct-pagination">

		<?php 
        $translated = __('Page', 'ctct');
        echo paginate_links(array('base' => esc_url_raw(add_query_arg(array('paged' => '%#%'))), 'current' => $current, 'total' => ceil(WP_Logging::get_log_count(0, $this->current_log_type) / $this->logs_per_page), 'type' => 'list', 'before_page_number' => '<span class="screen-reader-text">' . $translated . ' </span>'));
        ?>
		</div>
		<?php 
    }