public function product_listing()
    {
        require_once 'product-listing-custom.php';
        add_thickbox();
        $testListTable = new TT_Example_List_Table();
        $testListTable->prepare_items();
        ?>
		<div class="wrap">
			<h2>List Table Test</h2>
			<form id="movies-filter" method="get">
				<input type="hidden" name="page" value="<?php 
        echo $_REQUEST['page'];
        ?>
" />
				<?php 
        $testListTable->display();
        ?>
			</form>
		</div>
    <?php 
    }
/** *************************** RENDER TEST PAGE ********************************
 *******************************************************************************
 * This function renders the admin page and the example list table. Although it's
 * possible to call prepare_items() and display() from the constructor, there
 * are often times where you may need to include logic here between those steps,
 * so we've instead called those methods explicitly. It keeps things flexible, and
 * it's the way the list tables are used in the WordPress core.
 */
function tt_render_list_page()
{
    //Create an instance of our package class...
    $testListTable = new TT_Example_List_Table();
    //Fetch, prepare, sort, and filter our data...
    $testListTable->prepare_items();
    ?>
    <div class="wrap">
        
        <div id="icon-users" class="icon32"><br/></div>
        <h2>List Table Test</h2>
        
        <div style="background:#ECECEC;border:1px solid #CCC;padding:0 10px;margin-top:5px;border-radius:5px;-moz-border-radius:5px;-webkit-border-radius:5px;">
            <p>This page demonstrates the use of the <tt><a href="http://codex.wordpress.org/Class_Reference/WP_List_Table" target="_blank" style="text-decoration:none;">WP_List_Table</a></tt> class in plugins.</p> 
            <p>For a detailed explanation of using the <tt><a href="http://codex.wordpress.org/Class_Reference/WP_List_Table" target="_blank" style="text-decoration:none;">WP_List_Table</a></tt>
            class in your own plugins, you can view this file <a href="<?php 
    echo admin_url('plugin-editor.php?plugin=' . plugin_basename(__FILE__));
    ?>
" style="text-decoration:none;">in the Plugin Editor</a> or simply open <tt style="color:gray;"><?php 
    echo __FILE__;
    ?>
</tt> in the PHP editor of your choice.</p>
            <p>Additional class details are available on the <a href="http://codex.wordpress.org/Class_Reference/WP_List_Table" target="_blank" style="text-decoration:none;">WordPress Codex</a>.</p>
        </div>
        
        <!-- Forms are NOT created automatically, so you need to wrap the table in one to use features like bulk actions -->
        <form id="movies-filter" method="get">
            <!-- For plugins, we also need to ensure that the form posts back to our current page -->
            <input type="hidden" name="page" value="<?php 
    echo $_REQUEST['page'];
    ?>
" />
            <!-- Now we can render the completed list table -->
            <?php 
    $testListTable->display();
    ?>
        </form>
        
    </div>
    <?php 
}
Beispiel #3
0
/**
 * Callback function for 'wp_ajax__ajax_fetch_custom_list' action hook.
 * 
 * Loads the Custom List Table Class and calls ajax_response method
 */
function _ajax_fetch_custom_list_callback()
{
    $wp_list_table = new TT_Example_List_Table();
    $wp_list_table->ajax_response();
}
/**
 * CALLBACK TO RENDER THE EXAMPLE ADMIN PAGE
 *
 * This function renders the admin page and the example list table. Although it's
 * possible to call `prepare_items()` and `display()` from the constructor, there
 * are often times where you may need to include logic here between those steps,
 * so we've instead called those methods explicitly. It keeps things flexible, and
 * it's the way the list tables are used in the WordPress core.
 */
function tt_render_list_page()
{
    // Create an instance of our package class.
    $test_list_table = new TT_Example_List_Table();
    // Fetch, prepare, sort, and filter our data.
    $test_list_table->prepare_items();
    // Include the view markup.
    include dirname(__FILE__) . '/views/page.php';
}