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

Fix: Hide empty categories in categories block. #13549

Merged
merged 1 commit into from Jan 29, 2019

Conversation

Projects
None yet
3 participants
@jorgefilipecosta
Copy link
Member

jorgefilipecosta commented Jan 28, 2019

Description

Fixes: #13440

This PR uses hide_empty option during categories request to make sure categories that have no posts are not displayed in the categories block edit view. On the frontend, they are not rendered so the edit view should replicate that.

Some categories may still show zero as a count. That happens because these categories have descendant categories with posts associated to them.

How has this been tested?

Add the categories block.
Enable the show post count option.
Verify categories with no posts associated to them or one of their descendants don't appear in the edit view.

@Soean

Soean approved these changes Jan 29, 2019

Copy link
Member

Soean left a comment

Backend (JS):
bildschirmfoto 2019-01-29 um 11 14 18

Frontend (PHP):
bildschirmfoto 2019-01-29 um 11 14 42

In the PHP code, the parent categories also sum up the count of the child categories. Maybe we can solve this with a server side rendered block?
Empty child categories are hidden, the structure is now the same in the frontend and backend, so I think this PR is fine.

@jorgefilipecosta jorgefilipecosta merged commit a13d933 into master Jan 29, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@jorgefilipecosta jorgefilipecosta deleted the fix/hide-empty-cagories-in-categories-block branch Jan 29, 2019

@youknowriad youknowriad added this to the 5.0 (Gutenberg) milestone Jan 29, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment