-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Taxonomy: Add UI to Category page to indicate default category #10831
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
base: trunk
Are you sure you want to change the base?
Changes from all commits
102b5bc
f0421a5
4dc573e
b7e0e1a
eadf8ac
c985c34
52e5831
fa26a3a
1ec2f96
ef7c23a
7b3573f
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 |
|---|---|---|
|
|
@@ -627,11 +627,14 @@ | |
| <div class="form-wrap edit-term-notes"> | ||
| <p> | ||
| <?php | ||
| $default_category_id = get_option( 'default_category' ); | ||
| printf( | ||
| /* translators: %s: Default category. */ | ||
| __( 'Deleting a category does not delete the posts in that category. Instead, posts that were only assigned to the deleted category are set to the default category %s. The default category cannot be deleted.' ), | ||
| /* translators: 1: Default category name, 2: URL to edit the default category, 3: URL to Writing Settings. */ | ||
| __( 'Deleting a category does not delete the posts in that category. Instead, posts that were only assigned to the deleted category are set to the default category %1$s. The default category cannot be deleted, but it can be <a href="%2$s">renamed</a> or you can choose a <a href="%3$s">different default category</a>.' ), | ||
| /** This filter is documented in wp-includes/category-template.php */ | ||
| '<strong>' . apply_filters( 'the_category', get_cat_name( get_option( 'default_category' ) ), '', '' ) . '</strong>' | ||
| '<strong>' . apply_filters( 'the_category', get_cat_name( $default_category_id ), '', '' ) . '</strong>', | ||
| esc_url( get_edit_term_link( $default_category_id, 'category' ) ), | ||
| esc_url( admin_url( 'options-writing.php#default_category' ) ) | ||
|
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. Ah, if the user cannot
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. I assume for translations, I should either break it into two sentences or have two complete sentences as the options. I don't know but I figure a language might not like assuming a dependent clause being forced to follow the primary clause (not to mention punctuation). On mobile but I'll update that. I appreciate your diligence in these reviews! This is a very old issue and was a very old patch that we're pulling out of the time capsule!
This comment was marked as duplicate.
Sorry, something went wrong.
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. That's right. Having a dependent clause as a separate translation string wouldn't work. So this would be one string:
And then, if the user can
Or if they just have term editing capability:
And then if they just have
Might be something to get advice from Polyglots on. |
||
| ); | ||
| ?> | ||
| </p> | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -383,6 +383,12 @@ public function column_cb( $item ) { | |||||
| public function column_name( $tag ) { | ||||||
| $taxonomy = $this->screen->taxonomy; | ||||||
|
|
||||||
| $default_term = get_option( 'default_' . $taxonomy ); | ||||||
| $default_term_label = ''; | ||||||
| if ( $tag->term_id === (int) $default_term ) { | ||||||
| $default_term_label = ' — <span class="taxonomy-default-label">' . __( 'Default' ) . '</span>'; | ||||||
| } | ||||||
|
|
||||||
| $pad = str_repeat( '— ', max( 0, $this->level ) ); | ||||||
|
|
||||||
| /** | ||||||
|
|
@@ -422,8 +428,9 @@ public function column_name( $tag ) { | |||||
| } | ||||||
|
|
||||||
| $output = sprintf( | ||||||
| '<strong>%s</strong><br />', | ||||||
| $name | ||||||
| '<strong>%s%s</strong><br />', | ||||||
| $name, | ||||||
| $default_term_label | ||||||
| ); | ||||||
|
|
||||||
| /** This filter is documented in wp-admin/includes/class-wp-terms-list-table.php */ | ||||||
|
|
@@ -532,6 +539,14 @@ protected function handle_row_actions( $item, $column_name, $primary ) { | |||||
| ); | ||||||
| } | ||||||
|
|
||||||
| if ( 'category' === $taxonomy && (int) get_option( 'default_category' ) === $tag->term_id ) { | ||||||
|
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.
Suggested change
|
||||||
| $actions['change-default'] = sprintf( | ||||||
| '<a href="%s">%s</a>', | ||||||
| admin_url( 'options-writing.php#default_category' ), | ||||||
| __( 'Change Default' ) | ||||||
| ); | ||||||
| } | ||||||
|
|
||||||
| /** | ||||||
| * Filters the action links displayed for each term in the Tags list table. | ||||||
| * | ||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.