-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Introduce WP_List_Table::get_views_links().
#2828
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
57b7e5f
809ab76
3a7181f
588c02b
7d4de21
5a358f2
d1fbe28
fea9e02
4361d93
3de35a5
47f5f9d
0425791
9f34460
bcb9adc
8b4c3cb
bcdadf3
815daf5
ea3e1cd
ac36df8
e54bf12
f400ab7
9e30826
79639ea
0d11699
ae2ebd7
45333b4
e4a63bb
5945f30
be0780b
92a05b4
d26fdc0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -331,16 +331,16 @@ protected function get_views() { | |
| number_format_i18n( $this->user_posts_count ) | ||
| ); | ||
|
|
||
| $mine = $this->get_edit_link( $mine_args, $mine_inner_html, $class ); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FYI:
These can be replaced to use This is another use case for a general function like the proposed wp_create_links().
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| $mine = array( | ||
| 'url' => esc_url( add_query_arg( $mine_args, 'edit.php' ) ), | ||
| 'label' => $mine_inner_html, | ||
| 'current' => isset( $_GET['author'] ) && ( $current_user_id === (int) $_GET['author'] ), | ||
| ); | ||
|
|
||
| $all_args['all_posts'] = 1; | ||
| $class = ''; | ||
| } | ||
|
|
||
| if ( empty( $class ) && ( $this->is_base_request() || isset( $_REQUEST['all_posts'] ) ) ) { | ||
| $class = 'current'; | ||
| } | ||
|
|
||
| $all_inner_html = sprintf( | ||
| /* translators: %s: Number of posts. */ | ||
| _nx( | ||
|
|
@@ -352,7 +352,11 @@ protected function get_views() { | |
| number_format_i18n( $total_posts ) | ||
| ); | ||
|
|
||
| $status_links['all'] = $this->get_edit_link( $all_args, $all_inner_html, $class ); | ||
| $status_links['all'] = array( | ||
| 'url' => esc_url( add_query_arg( $all_args, 'edit.php' ) ), | ||
| 'label' => $all_inner_html, | ||
| 'current' => empty( $class ) && ( $this->is_base_request() || isset( $_REQUEST['all_posts'] ) ), | ||
| ); | ||
|
|
||
| if ( $mine ) { | ||
| $status_links['mine'] = $mine; | ||
|
|
@@ -381,7 +385,11 @@ protected function get_views() { | |
| number_format_i18n( $num_posts->$status_name ) | ||
| ); | ||
|
|
||
| $status_links[ $status_name ] = $this->get_edit_link( $status_args, $status_label, $class ); | ||
| $status_links[ $status_name ] = array( | ||
| 'url' => esc_url( add_query_arg( $status_args, 'edit.php' ) ), | ||
| 'label' => $status_label, | ||
| 'current' => isset( $_REQUEST['post_status'] ) && $status_name === $_REQUEST['post_status'], | ||
| ); | ||
| } | ||
|
|
||
| if ( ! empty( $this->sticky_posts_count ) ) { | ||
|
|
@@ -404,15 +412,19 @@ protected function get_views() { | |
| ); | ||
|
|
||
| $sticky_link = array( | ||
| 'sticky' => $this->get_edit_link( $sticky_args, $sticky_inner_html, $class ), | ||
| 'sticky' => array( | ||
| 'url' => esc_url( add_query_arg( $sticky_args, 'edit.php' ) ), | ||
| 'label' => $sticky_inner_html, | ||
| 'current' => ! empty( $_REQUEST['show_sticky'] ), | ||
| ), | ||
| ); | ||
|
|
||
| // Sticky comes after Publish, or if not listed, after All. | ||
| $split = 1 + array_search( ( isset( $status_links['publish'] ) ? 'publish' : 'all' ), array_keys( $status_links ), true ); | ||
| $status_links = array_merge( array_slice( $status_links, 0, $split ), $sticky_link, array_slice( $status_links, $split ) ); | ||
| } | ||
|
|
||
| return $status_links; | ||
| return $this->get_views_links( $status_links ); | ||
| } | ||
|
|
||
| /** | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.