/** * * @return array */ protected function get_table_classes() { $classes = parent::get_table_classes(); $classes[] = 'wp-list-table'; $classes[] = 'comments-box'; return $classes; }
function search($results, $search_term) { $search_url = esc_url(admin_url(sprintf('edit-comments.php?s=%s', urlencode($search_term)))); $search_link = sprintf(' <a href="%s" class="add-new-h2">%s</a>', $search_url, esc_html__('Search Comments', 'jetpack')); $html = '<h2>' . esc_html__('Comments', 'jetpack') . $search_link . '</h2>'; parent::__construct(); ob_start(); $this->prepare_items(); $this->_column_headers = array($this->get_columns(), array(), array()); $this->display(); $html .= ob_get_clean(); $label = __('Comments', 'jetpack'); $results[$label] = $html; return $results; }
function get_table_classes() { $classes = parent::get_table_classes(); $classes[] = 'comments-box'; return $classes; }
/** * Get WP default links columns. * * @since 1.3.1 */ private function get_wp_default_comments_columns() { // You can use this filter to add third_party columns by hooking into this. do_action('cpac-get-default-columns-comments'); // dependencies if (file_exists(ABSPATH . 'wp-admin/includes/class-wp-list-table.php')) { require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; } if (file_exists(ABSPATH . 'wp-admin/includes/class-wp-comments-list-table.php')) { require_once ABSPATH . 'wp-admin/includes/class-wp-comments-list-table.php'; } // As of WP Release 3.5 we can use the following. if (version_compare(get_bloginfo('version'), '3.4.10', '>=')) { $table = new WP_Comments_List_Table(array('screen' => 'edit-comments')); $columns = $table->get_columns(); } else { global $current_screen; // save original $org_current_screen = $current_screen; // prevent php warning if (!isset($current_screen)) { $current_screen = new stdClass(); } // overwrite current_screen global with our media id... $current_screen->id = 'edit-comments'; // init table object $wp_comment = new WP_Comments_List_Table(); // get comments $columns = $wp_comment->get_columns(); // reset current screen $current_screen = $org_current_screen; } // change to uniform format $columns = $this->get_uniform_format($columns); // add sorting to some of the default links columns $columns = $this->set_sorting_to_default_comments_columns($columns); return apply_filters('cpac-default-comments-columns', $columns); }