Wp_List_Table Search_Box Example
- Article
- Comment (2)
Introduction
WordPress wp_list_table
is a pretty nice option to create our own custom table for admin with custom datas. But there are some difficulties and miss understandings in the usage of the table and its function. Let’s see the Wp_List_Table Search_Box Example with Some demo codes.
I already long back wrote a tutorial regarding the wp_list_table
eventhough this is new with custom search operations. I have written it separately as new topic with some sample codes. Example Code for you.
function prepare_items($search ='') { global $wpdb; $Mail_Queue = $wpdb->prefix.'Kvcodes' ; $per_page = 10; $query = "SELECT name, fullame, email FROM $Mail_Queue "; // your Query to get items from table. if(!empty($search)){ $query .= " AND (name LIKE '%{$search}%' OR fullame LIKE '%{$search}%' OR email LIKE '%{$search}%' )"; }
And this will be code to create object for your class wp_list_table and use it inside a form and make the search operations.
echo '</pre><div class="wrap"><h2>Mail Queue </h2> <form method="post" > <input type="hidden" name="page" value="kv_subscriptions">'; if( isset($_POST['s']) ){ $mailQueue->prepare_items($_POST['s']); } else { $mailQueue->prepare_items(); } $mailQueue->search_box( 'search', 'search_id' ); $mailQueue->display();
This code helps to create search box in every website. sometimes,we have big list of items. so we need form clearning and filtering option to create it. I hope you will understand this article and work on. If you have doubts or clarifications, knock me through the contact form. If you are looking forward to work with me on WordPress and other custom projects. Use Contact form to knock me.
This post should be titled “How to create a SQL injection backdoor to your site”
Are you sure the content related to backdoor login or you posted to make us mad.