/** * Load admin scripts and styles. */ function load_scripts() { $screen = get_current_screen(); if (!$screen || 'edit-wpm-testimonial' != $screen->id) { return; } if (wpmtst_is_column_sorted()) { return; } wp_enqueue_script('wpmtst-admin-order-script', WPMTST_URL . 'js/wpmtst-admin-order.js', array('jquery-effects-highlight', 'jquery-ui-sortable'), null, true); wp_localize_script('wpmtst-admin-order-script', 'ajax_object', array('ajaxurl' => admin_url('admin-ajax.php'))); wp_enqueue_style('wpmtst-admin-order-style', WPMTST_URL . '/css/admin/order.css', array(), null); }
/** * Show custom values * * @param $column */ function wpmtst_custom_columns($column) { global $post; switch ($column) { case 'post_id': echo $post->ID; break; case 'post_content': echo substr($post->post_content, 0, 100) . '…'; break; case 'post_excerpt': echo $post->post_excerpt; break; case 'thumbnail': echo get_the_post_thumbnail($post->ID, array(75, 75)); break; case 'category': $categories = get_the_terms(0, 'wpm-testimonial-category'); if ($categories && !is_wp_error($categories)) { $list = array(); foreach ($categories as $cat) { $list[] = $cat->name; } echo join(", ", $list); } break; case 'handle': if (current_user_can('edit_post', $post->ID) && !wpmtst_is_column_sorted() && !wpmtst_is_viewing_trash()) { echo '<div class="handle"><div class="help"></div><div class="help-in-motion"></div></div>'; } break; default: // custom field? $custom = get_post_custom(); if (isset($custom[$column])) { echo $custom[$column][0]; } } }