Make WordPress Core

Opened 12 years ago

Closed 9 years ago

Last modified 9 years ago

#21856 closed enhancement (fixed)

Hide category selection when no posts are available

Reported by: coenjacobs's profile CoenJacobs Owned by: wonderboymusic's profile wonderboymusic
Milestone: 4.4 Priority: normal
Severity: normal Version: 3.1
Component: Posts, Post Types Keywords: ux-feedback has-patch needs-screenshots
Focuses: ui, administration Cc:

Description

Just an idea that popped up while testing #21015. The months dropdown gets hidden when there are no posts available, so why not hide the category dropdown list too?

Might be a bit confusing though, when certain elements are not showing when you first start using the screens that these elements are used. But showing something that does not do what it looks like is even more confusing, I think.

Attachments (3)

categories-dropdown.png (13.1 KB) - added by CoenJacobs 12 years ago.
The select box that I'm referring to
21856.diff (499 bytes) - added by egower 12 years ago.
21856.2.patch (624 bytes) - added by CoenJacobs 11 years ago.
Revised patch, tested against current trunk

Download all attachments as: .zip

Change History (17)

#1 @SergeyBiryukov
12 years ago

  • Component changed from General to Administration

#2 follow-up: @nofearinc
12 years ago

Related to this, the get_terms function returns only taxonomy terms with some posts inside unless hide_empty is assigned a true value.

#3 in reply to: ↑ 2 @CoenJacobs
12 years ago

Replying to nofearinc:

Related to this, the get_terms function returns only taxonomy terms with some posts inside unless hide_empty is assigned a true value.

No, not related. This is on the edit.php screen, where there is also a category selection element. This does not hide when there are no posts but shows categories regardless of having posts.

Last edited 12 years ago by CoenJacobs (previous) (diff)

#4 follow-up: @nofearinc
12 years ago

Seems like the problem has been taken care of in revision 21806

#5 in reply to: ↑ 4 @CoenJacobs
12 years ago

Replying to nofearinc:

Seems like the problem has been taken care of in revision 21806

No, it is not that. Sorry about not being clearer, but I mean the category select box right above the list of posts on the edit.php screen. See attached screenshot.

@CoenJacobs
12 years ago

The select box that I'm referring to

@egower
12 years ago

#6 @egower
12 years ago

  • Keywords has-patch added

I see where you're referring to.

This is my first attempt at a Wordpress patch, so I apologize in advance if any information I have submitted is in the wrong workflow order. Patch added.

@CoenJacobs
11 years ago

Revised patch, tested against current trunk

#7 @CoenJacobs
11 years ago

  • Keywords needs-testing added

Revised the patch, made sure the conditional only takes away the category dropdown instead of the whole element including the do_action( 'restrict_manage_posts' ); action.

#8 follow-up: @helen
11 years ago

  • Focuses ui added
  • Keywords ui-feedback removed

In what situation would this actually not show, given that a post more or less has to have a category? If you have no posts at all?

#9 @nacin
11 years ago

  • Component changed from Administration to Posts, Post Types
  • Focuses administration added

#10 in reply to: ↑ 8 @CoenJacobs
11 years ago

Replying to helen:

In what situation would this actually not show, given that a post more or less has to have a category? If you have no posts at all?

Exactly, when there are only auto drafts and no posts that will be shown on that page (but the conditional to show the category selection element will still see the auto drafts).

#11 @seanchayes
11 years ago

I ensured I had only an auto-draft post (or posts), made sure my All Posts view was saying "No posts found." and tested before and after applying the patch.

Without the patch the "View all categories" dropdown displayed and when I clicked on it and chose "Uncategorized" I still saw the "No posts found." screen.

I applied the patch and the "View all categories" dropdown" no longer displayed and again I still saw the "No posts found." screen.

#12 @swissspidy
9 years ago

  • Keywords needs-testing removed
  • Milestone changed from Awaiting Review to 4.4

Patch still applies and works without problems.

On my install I had 4 trashed posts and no other posts. Without the patch categories of trashed posts were shown, with the patch applied the category dropdown is hidden as expected.

I think we should get this into 4.4.

#13 @wonderboymusic
9 years ago

  • Owner set to wonderboymusic
  • Resolution set to fixed
  • Status changed from new to closed

In 34076:

List Tables: don't render "extra tablenav" if there are no posts. This includes Bulk Actions, Dates Dropdown, Category Dropdowns, Pagination.

Also ensure that the Months dropdown, when it is shown, shows months from the proper set of posts.

Props egower, CoenJacobs, MikeHansenMe, mehulkaklotar.
Fixes #33824, #21015, #21856.

#14 @ryan
9 years ago

  • Keywords needs-screenshots added
Note: See TracTickets for help on using tickets.