WordPress.org

Make WordPress Core

Opened 2 years ago

Last modified 5 months ago

#46614 assigned enhancement

Category/tag/taxonomy names on admin screens

Reported by: Dianakc Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Administration Keywords: has-patch needs-refresh
Focuses: Cc:

Description

Hello, I'd like to suggest that when browsing categories, tags any taxonomies in general the admin screen display the taxonomy title/name somewhere preferably at the very top as I see that newbie users feel confused when browsing posts from a specific category/tag/taxonomy.

Examples:

https://i.postimg.cc/xjHx4Nvt/01.png
When browsing the "Succulents" tag

https://i.postimg.cc/pXHGbVkx/02.png
When browsing the "Plants from Mexico" category

I also searched for some way to add this myself for some clients and can't find how to do so.

Thanks (sorry if this is out of scope/wrong place)

Attachments (1)

46614-category-tag-names.diff (486 bytes) - added by mikejdent 5 months ago.

Download all attachments as: .zip

Change History (6)

#1 follow-up: @sabernhardt
14 months ago

  • Keywords needs-patch added
  • Version 5.1 deleted

@Dianakc Hi and thanks for the ticket!

The heading text is rather strict in wp-admin/edit.php:

<h1 class="wp-heading-inline">
<?php
echo esc_html( $post_type_object->labels->name );
?>
</h1>

So in U.S. English it's always "Posts" for standard posts, "Pages" for the pages, and the main (plural) label for any custom post type.

It could be good to create a filter for customizing the heading text.

#2 in reply to: ↑ 1 @Dianakc
14 months ago

Hello,
Sorry but you're confusing taxonomies with custom post types, the ticket is about the page titles, taxonomy pages should display the taxonomy they are showing, that's all.

#3 @sabernhardt
14 months ago

@Dianakc Sorry for the confusion. Mentioning the pages and custom post type names is not necessarily relevant.

But my point was that the headings for post listing screens always match the post type, even when the posts in that list are restricted to one category, tag or other taxonomy. Adding the selected taxonomy name there should require a patch to wp-admin/edit.php.

#4 @mikejdent
5 months ago

  • Keywords has-patch needs-testing added; needs-patch removed

Hi @Dianakc and @sabernhardt!

I think we should be able to do this by appending get_the_archive_title(); to the end of the heading. That way we can still see the Post Type, but also what taxonomy we are browsing. If there is no taxonomy (ie the top-level page) then it returns the word "Archives" which can then be filtered out.

Could probably do with some e2e to check I haven't missed any edge cases.

https://i.postimg.cc/tCpY0gdd/posts.jpg
https://i.postimg.cc/Wz6zFRVJ/author.jpg
https://i.postimg.cc/nVvCwmmc/category.jpg

#5 @sabernhardt
5 months ago

  • Keywords needs-refresh added; needs-testing removed

@mikejdent Thanks for creating a patch! A few tips for next time:

  • Use classes instead of style attributes
  • Use spacing according to PHP coding standards
  • Pay attention to translation functions: __( 'Archives' ) instead of Archives

If the filter information does not need to be inside the heading, we could use the same <span class="subtitle"> that currently shows search queries after the Add New link.

https://live.staticflickr.com/65535/51011683751_b1347ae0d2_c.jpg

If added inside the heading, the class could be reused there with a different margin in that context (and perhaps a small tag instead of span).

I am having some trouble with the archive title when using the date filter, at least on the Pages screen.

Note: See TracTickets for help on using tickets.