Posts

Showing posts with the label admin-side-development

How to create a custom wp_list_table and bulk action in wordpress

Below is a example of how to create a  custom wp_list_table and bulk actions.. Change below code according to your requirements. <?php global $wpdb; $table = $wpdb->prefix.'pp_buyer_package'; if($_REQUEST['action']=='delete' || $_REQUEST['action2']=='delete') {         if(isset($_REQUEST['pak_ids']) && $_REQUEST['_wpnonce']!='')     {         foreach($_REQUEST['pak_ids'] as $item)         {                $end_time = strtotime('now');             $cr_select = 'select * from '.$wpdb->prefix.'pp_package_buyer_relation where package_id = "'.$item.'" and end_time >= "'.$end_time.'"';             $cr_result =  $wpdb->get_row($cr_select);             if(count($cr...

How to add a custom column in custom post type list in admin side wordpress

For add a custom column in admin side list for custom post type or any post type just copy and paste below code into your theme's functions.php function rj_display_rank_column_data( $column, $post_id ) {     global $wpdb;     switch ( $column ) {         case 'rank' :                     $rank = get_post_meta($post_id,'optimus_rank_field',true);                if($rank!='9999' && $rank!='')                {                 echo $rank;                }else               ...

How to add a custom field or meta box in wordpress post or any custom post type in admin side

For add a meta box or custom filed to your any post type  just copy below code and add it into your theme's functions.php file and change according to you need. function rj_feature_video_add_meta_box() {     $screens = array( 'firework-video' );   // change post type slugs     foreach ( $screens as $screen ) {         add_meta_box(             'feature_video_fireworks',             __( 'Feature Video', 'flatsome' ),             'rj_feature_video_fireworks_meta_box_callback',             $screen         );     } } add_action( 'add_meta_boxes', 'rj_feature_video_add_meta_box' ); function rj_feature_video_fireworks_meta_box_callback( $post ) {     wp_nonce_field( 'rj_feature_v...