after struggling 3 hours after posting the question here, I examined the class and found a solution, so I report the information here.
There is a function function extra_tablenav ($ which), I override this function with my function,
function extra_tablenav( $which ) { global $wpdb, $testiURL, $tablename, $tablet; $move_on_url = '&cat-filter='; if ( $which == "top" ){ ?> <div class="alignleft actions bulkactions"> <?php $cats = $wpdb->get_results('select * from '.$tablename.' order by title asc', ARRAY_A); if( $cats ){ ?> <select name="cat-filter" class="ewc-filter-cat"> <option value="">Filter by Category</option> <?php foreach( $cats as $cat ){ $selected = ''; if( $_GET['cat-filter'] == $cat['id'] ){ $selected = ' selected = "selected"'; } $has_testis = false; $chk_testis = $wpdb->get_row("select id from ".$tablet." where banner_id=".$cat['id'], ARRAY_A); if( $chk_testis['id'] > 0 ){ ?> <option value="<?php echo $move_on_url . $cat['id']; ?>" <?php echo $selected; ?>><?php echo $cat['title']; ?></option> <?php } } ?> </select> <?php } ?> </div> <?php } if ( $which == "bottom" ){
and then I jumped into the prepare_items () function and added a line after the query line,
if( $_GET['cat-filter'] > 0 ){ $query = $query . ' where cat_id=' . $_GET['cat-filter']; }
not finished here, i added some javascript lines to do drop down,
$('.ewc-filter-cat').live('change', function(){ var catFilter = $(this).val(); if( catFilter != '' ){ document.location.href = 'admin.php?page=ewc-testimonial'+catFilter; } });
and his work is cool and beautiful, if someone needs extra help, then comment here.
Thank you for your time.
Mian majid
source share