Make WordPress Core

Opened 8 years ago

Closed 7 years ago

Last modified 7 years ago

#39531 closed defect (bug) (fixed)

Twenty Fourteen, Fifteen, Seventeen: allow category display in post preview even when only 1 category

Reported by: lancewillett's profile lancewillett Owned by: davidakennedy's profile davidakennedy
Milestone: 4.9 Priority: normal
Severity: normal Version:
Component: Bundled Theme Keywords: has-patch
Focuses: Cc:

Description (last modified by lancewillett)

Steps to repeat

  1. Using a site with only the category, "Uncategorized, switch to Twenty Fourteen or Twenty Fifteen.
  2. Create new post draft, and in the post meta box for Categories add a new category.
  3. Save (don't publish), and Preview.
  4. The new category will not be in the preview.
  5. If you publish, the end result shows two categories, as expected.

What I expected
For the post preview to show the 2nd category I added, after saving the post.

What happened instead
The category is not shown in the preview. And because of how twentyfifteen_categorized_blog() returns false for 1 or fewer categories, in this case it won't show the new category.

Screenshots
Attached.

Note: this occurs in Twenty Sixteen as well, bug logged in GitHub: https://github.com/WordPress/twentysixteen/pull/492

Attachments (8)

39531.diff (1.1 KB) - added by lancewillett 8 years ago.
1 - Categories.png (729.1 KB) - added by lancewillett 8 years ago.
2 - Post Draft, No New Category.png (640.1 KB) - added by lancewillett 8 years ago.
3 - Post Draft, Added New Category.png (652.7 KB) - added by lancewillett 8 years ago.
4 - Front End Preview, No Categories Showing.png (86.3 KB) - added by lancewillett 8 years ago.
5 - (After Patch) Front End Shows Categories.png (100.7 KB) - added by lancewillett 8 years ago.
39531.2.diff (1.7 KB) - added by lancewillett 8 years ago.
39531.2.patch (589 bytes) - added by davidakennedy 7 years ago.
Allow category display in post preview even when only 1 category for Twenty Sixteen

Change History (23)

@lancewillett
8 years ago

#1 @lancewillett
8 years ago

  • Description modified (diff)

#2 in reply to: ↑ description @SergeyBiryukov
8 years ago

Replying to lancewillett:

Note: this occurs in Twenty Sixteen as well (but it's not in the develop src repo that I can see.)

Per comment:1:ticket:38468, Twenty Sixteen issues should be reported on GitHub: https://github.com/WordPress/twentysixteen/issues.

Looking at Twenty Seventeen though, seems like it would also be affected?

#3 @lancewillett
8 years ago

Looking at Twenty Seventeen though, seems like it would also be affected?

Good point, I missed it. Will add a patch here shortly.

Twenty Sixteen pull request added here: https://github.com/WordPress/twentysixteen/pull/492 — thanks for the reminder on that.

@lancewillett
8 years ago

#4 @lancewillett
8 years ago

  • Summary changed from Twenty Fourteen / Fifteen: category count transient allows incorrect preview when only 1 category to Twenty Fourteen, Fifteen, Seventeen: allow category display in post preview even when only 1 category

#5 @SergeyBiryukov
8 years ago

  • Milestone changed from Awaiting Review to 4.8

#6 @davidakennedy
8 years ago

Great find @lancewillett! I tested and can confirm the bug. I also tested the patch and it works well. I think this one should be good to go.

#7 @lancewillett
8 years ago

  • Description modified (diff)

#8 @davidakennedy
8 years ago

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

In 40023:

Bundled Themes: Allow category display in post preview even when only one category

The category is not shown in the preview. And because of how themename_categorized_blog() function in each theme returns false for 1 or fewer categories, and in this case it won't show the new category.

The patch uses is_preview() to fix that in Twenty Fourteen, Fifteen and Seventeen.

Props lancewillett.

Fixes #39531.

#9 @lancewillett
8 years ago

@davidakennedy Can you review and merge my Twenty Sixteen patch also? https://github.com/WordPress/twentysixteen/pull/492

#10 @SergeyBiryukov
7 years ago

  • Milestone changed from 4.8 to 4.8.1
  • Resolution fixed deleted
  • Status changed from closed to reopened

There's a consensus on merging Twenty Sixteen into core SVN in #36497, reopening to make sure it gets the fix as well.

#11 @irebu
7 years ago

i don't know why needed twentyfifteen_categorized_blog(), twentysexteen_categorized_blog(), twentyseventeen_categorized_blog(), i will delete it from tamplate, or change inside function get_categories(array(...)) to get_the_category()

@davidakennedy
7 years ago

Allow category display in post preview even when only 1 category for Twenty Sixteen

#12 @davidakennedy
7 years ago

I ported over the patch from Lance on https://github.com/WordPress/twentysixteen/pull/492/files since Twenty Sixteen is no longer maintained on GitHub. Make sure @lancewillett gets props.

#13 @SergeyBiryukov
7 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 40908:

Twenty Sixteen: Allow category display in post preview even when there is only one category.

Props lancewillett, davidakennedy.
Fixes #39531.

This ticket was mentioned in Slack in #core by westonruter. View the logs.


7 years ago

#15 @pento
7 years ago

  • Milestone changed from 4.8.1 to 4.9

This seems to be a fairly low impact bug, so I'm moving it to 4.9. It doesn't need to be backported to the 4.8 branch.

Note: See TracTickets for help on using tickets.