'', // Unused. Messages start at index 1. 1 => sprintf( __('%s updated. View %s'), 'Testimonial', esc_url( get_permalink($post_ID) ), 'Testimonial' ), 2 => __('Custom field updated.'), 3 => __('Custom field deleted.'), 4 => __(strtolower('Testimonial'). ' updated.'), /* translators: %s: date and time of the revision */ 5 => isset($_GET['revision']) ? sprintf( __('%s restored to revision from %s'),'Testimonial', wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, 6 => sprintf( __('%s published. View %s'), 'Testimonial', esc_url( get_permalink($post_ID) ), strtolower('Testimonial') ), 7 => __('Testimonial'. ' Saved.'), 8 => sprintf( __('%s submitted. Preview %s'), 'Testimonial', esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ), strtolower('Testimonial') ), 9 => sprintf( __('%s scheduled for: %2$s. Preview %1$s'), 'Testimonial', date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink($post_ID) ) ), 10 => sprintf( __('%s draft updated. Preview %s'), 'Testimonial', esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ), strtolower('Testimonial') ), ); return $messages; } /** * * Custom Submit Box * * Loop throught custom post types and * replace default submit box * * @since 1.0 * */ public static function alpha_replace_submit_meta_box() { remove_meta_box('submitdiv', 'tf_testimonials', 'core'); add_meta_box('submitdiv', sprintf( __('Save/Update %s'), 'Testimonial' ), array( 'Alpha_Interface', 'alpha_submit_meta_box' ), 'tf_testimonials', 'side', 'low'); } /** * Custom edit of default wordpress publish box callback * loop through each custom post type and remove default * submit box, replacing it with custom one that has * only submit button with custom text on it (add/update) * * @global $action, $post * @see wordpress/includes/metaboxes.php * @since 1.0 * */ public static function alpha_submit_meta_box() { global $action, $post; $post_type = $post->post_type; $post_type_object = get_post_type_object($post_type); $can_publish = current_user_can($post_type_object->cap->publish_posts); ?>
ID ) ) { if ( !EMPTY_TRASH_DAYS ) $delete_text = __('Delete Permanently'); else $delete_text = __('Move to Trash'); ?>
post_status, array('publish', 'future', 'private') ) || 0 == $post->ID ) { if ( $can_publish ) : ?> 'p' ) ); ?>
'', 'title' => __('Testimonial Title', 'alpha'), 'name' => __('Customer', 'alpha'), 'ulg' => __('His Title', 'alpha'), 'icon' => __( 'Image', 'alpha' ), 'date' => __('Date', 'alpha') ); return $cols; } // testimonials_custom_columns() /** * * Custom Columns Callback Function * * @param $column, $post_id * @global $alpha * @return string * @since 1.0 */ public static function testimonials_custom_column_content( $column, $post_id ) { switch ( $column ) { case "icon": $image[0] = plugin_dir_url( __FILE__ ) . '../assets/images/customer.png'; if( has_post_thumbnail( $post_id ) ){ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post_id ), array(72,72) ); } echo ''; break; case 'name': $name = get_post_meta( $post_id, 'alpha_name', true ); if( $name ){ echo $name; } break; case 'ulg': $title = get_post_meta( $post_id, 'alpha_title', true ); $company = get_post_meta( $post_id, 'alpha_company', true ); if( $title ){ echo $title . ' at ' . $company; } break; } } //testimonials_custom_column_content() public static function init() { self::hooks(); } }//class end; }//if !class_exists() ?>