Coder Social home page Coder Social logo

wp-list-table-example's Introduction

=== Custom WP List Table Example ===
Contributors: Veraxus
Donate link: http://www.mattvanandel.com/
Tags: example, table, data, WP_List_Table, admin, plugin, list table
Requires at least: 3.5
Tested up to: 4.5
Stable tag: 1.5

A highly documented plugin that demonstrates how to create custom admin list-tables using official WordPress techniques.

== Description ==

This plugin serves as a highly documented example of using WordPress's built-in WP_List_Table class for plugin development. Previously, WordPress plugins had to create list tables from scratch, leading to wildly inconsistent WordPress admin experiences. This example serves to help clarify use of the WP_List_Table class for quickly and easily generating consistent, standardized, feature-rich list-tables for WordPress admin screens.

For demonstration purposes, this plugin creates one new menu item in your admin: "List Table Example". This page includes an example table and all the documentation needed to reproduce and extend it. Developers who open the PHP file itself will find exceptionally well documented code outlining all the information needed to duplicate this feature.

For more information, please visit the <a href="http://codex.wordpress.org/Class_Reference/WP_List_Table">WP_List_Tables</a> page in the WordPress Codex.

== Changelog ==

= 1.5 =
* Numerous tweaks, improvements, and clarifications compliments of Gary Jones.

= 1.4 =
* Minor addition to documentation.
* NOTE: No changes are required to maintain support with new list tables in WordPress 4.3!

= 1.3 =
* Minor updates to documentation
* Fixed the WordPress Plugin Editor link on the example admin page

= 1.2 =
* Fixed a minor bug that could result in sorting not quite working as expected

= 1.1 =
* Fixed an incorrect codex link in the readme

= 1.0 =
* Demonstrates usage of WP_List_Table
* Demonstrates pagination
* Demonstrates column sorting
* Demonstrates inline actions
* Demonstrates bulk actions

wp-list-table-example's People

Contributors

garyjones avatar jonathanbossenger avatar veraxus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wp-list-table-example's Issues

"Request-URI Too Long" error

After testing my bulk actions, I received this error from Apache:

Request-URI Too Long
The requested URL's length exceeds the capacity limit for this server.

Then I noticed every time I was checking items, selecting a bulk action, then clicking "Apply", it was just adding onto to the URL parameters that were already there and using the new ones, so the URL was getting longer and longer every time and eventually reached the maximum length the server would accept. How do I clear the URL parameters every time I want to make another bulk action request?

No data shown but row count and pagination works?

Hi first I would just like to say a big thank you for the perfectly laid out example of this plugin, I tried using wp_list_table but didnt find good examples but yours is very easy to understand.

That being said I do have a problem however I dont think its with the script but rather the data I am passing to it, I installed the plugin to see it and it all works fine, I then copied the plugin main file into my plugin folder renamed it and also the class etc to integrate it into my plugin.

Like your example I am also not using a database for the data but rather I am connecting to the woocommerce API and storing the results into a multi dimensional associative array, however when I give this collected data to the script it is only getting some thing correct.

I have 7 orders that are collected via the API, I then loop over each order and store the data for that order in an associative array, after the for each I add them to the main array then I call that $data.

now when I view the page the correct amount of rows are returned and it even says 7 items in the pagination but the rows are all empty of data, however the data is there as I place a print_r($data); around pre tags and its shows me that $data is populate and in the correct way (i think).

I put the same print_r in the same place on your activated plugin to compare and the structure is the same (see below).

ok time for some show and tell, at the top of the page just under the class I have this

`class Orders_List_Table extends WP_List_Table {

// create our container array
var $MultiArray = array();

`
I make the API call where the example had this line (removed now)

$data = $this->example_data;

when the API returns the data I do a foreach orders as order and setup the array as follows

` foreach($Orders as $Order)

// do some stuff to the returned data and then store what I need in the array below

    {
        $ThisOrder = array(
            'id' => $Order->id,
            'customer' => $shipping->first_name.' '.$shipping->last_name,
            'qty' => $QTY,
            'total' => $Order->currency.' '.$Order->total,
            'transaction_id' => $Order->transaction_id,
            'status' => $Order->status,
            'actions' => 'Actions',
        );

        // add it to our main array
        $MultiArray[] = $ThisOrder;

}`

after the foreach orders I add the following

` $data = $MultiArray;// all 7 orders in this example

    echo '<pre>';
    print_r($data);// all the orders are in $data
    echo '</pre>';`

the print_r shows the following (only showing 3 entries for brevity)

`Array
(
[0] => Array
(
[id] => 5761
[customer] => Jane Blogs
[qty] => 2
[total] => USD 89.98
[transaction_id] => 1248456354654564
[status] => processing
[actions] => Actions
)

[1] => Array
    (
        [id] => 5728
        [customer] => Joe Blogs
        [qty] => 1
        [total] => USD 49.99
        [transaction_id] => 1248456354654564
        [status] => processing
        [actions] => Actions
    )

[2] => Array
    (
        [id] => 5727
        [customer] => Micky Mouse
        [qty] => 2
        [total] => USD 89.98
        [transaction_id] => 1248456354654564
        [status] => processing
        [actions] => Actions
    )

)`

when I do a print_r on the example plugin loaded I get the following (again limited to 3)

`Array
(
[0] => Array
(
[ID] => 8
[title] => 2001
[rating] => G
[director] => Stanley Kubrick
)

[1] => Array
    (
        [ID] => 1
        [title] => 300
        [rating] => R
        [director] => Zach Snyder
    )

[2] => Array
    (
        [ID] => 2
        [title] => Eyes Wide Shut
        [rating] => R
        [director] => Stanley Kubrick
    )

)`

from what I can see they seem to have the same structure (different content obviously) but I can not see anything wrong, also no errors are thrown not even a warning (I have Query Monitor installed).

any ideas where this is going wrong?

thanks in advance for any help

Kind regards

Wayne

Too many errors.

Hello. will you update plugin? it has too many errors. thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.