Last active
December 8, 2016 04:55
-
-
Save vishnusomanus/9a966eb6a20f93347d8c5d3935c34753 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*Adding table titles and unset default titles*/ | |
add_filter('manage_waitlist_posts_columns' , 'add_waitlist_columns'); | |
function add_waitlist_columns($columns) { | |
unset($columns['author']); | |
unset($columns['seodesc']); //unset fields | |
unset($columns['seotitle']); | |
unset($columns['seokeywords']); | |
unset($columns['title']); | |
unset($columns['date']); | |
return array_merge($columns, | |
array( | |
'name' => __( 'Name', 'trans' ), | |
'wpcf-waitlist-email' => __( 'Email', 'trans' ), | |
'wpcf-courses' => __( 'Courses', 'trans' ), | |
'date' => __( 'Date', 'trans' ) | |
) | |
); | |
} | |
/*Adding table field values*/ | |
add_action('manage_waitlist_posts_custom_column' , 'waitlist_custom_columns', 10, 2 ); | |
function waitlist_custom_columns( $column, $post_id ) { | |
global $post; | |
switch ( $column ) { | |
case 'name' : | |
echo get_the_title($post_id); | |
break; | |
case 'date' : | |
echo get_the_date($post_id); | |
break; | |
case 'wpcf-waitlist-email' : | |
echo get_post_meta($post_id, 'wpcf-waitlist-email', true); | |
break; | |
case 'wpcf-courses' : | |
echo get_post_meta($post_id, 'wpcf-courses', true); | |
break; | |
} | |
} | |
/*remove actions under first column*/ | |
add_filter( 'post_row_actions', 'remove_row_actions', 10, 1 ); | |
function remove_row_actions( $actions ) | |
{ | |
if( get_post_type() === 'waitlist' ) | |
unset( $actions['edit'] ); | |
unset( $actions['view'] ); | |
unset( $actions['trash'] ); | |
unset( $actions['inline hide-if-no-js'] ); | |
return $actions; | |
} | |
/*remove bulk action Edit*/ | |
add_filter( 'bulk_actions-edit-waitlist', 'my_custom_bulk_actions' ); | |
function my_custom_bulk_actions( $actions ){ | |
unset( $actions[ 'edit' ] ); | |
return $actions; | |
} | |
/*remove submenu of custom post type*/ | |
add_action( 'admin_init', 'remove_waitlist_submenu' ); | |
function remove_waitlist_submenu() | |
{ | |
global $submenu; | |
unset( | |
$submenu['edit.php?post_type=waitlist'][5], | |
$submenu['edit.php?post_type=waitlist'][10] | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment