WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#38655 closed defect (bug) (fixed)

Correct Post Template not displaying when selecting Quick Edit

Reported by: ahortin Owned by: swissspidy
Milestone: 4.7 Priority: normal
Severity: normal Version: 4.7
Component: Posts, Post Types Keywords: has-patch commit
Focuses: template Cc:

Description

It was just announced that WP 4.7 will now support Post Type Templates.

I've just tested this out by using Template Post Type in the template header.

One thing I noticed is that when you select Quick Edit on the Posts list page, it's not displaying the correct template name.

I've edited my Post so that it now uses a 'Left Sidebar' template as can be seen here - https://cl.ly/1p0f1E1f1U10

When I select the Quick Edit option on the Posts page, the Template dropdown field is saying that it's using the Default Template, rather than my new 'Left Sidebar' template.

https://cl.ly/2s0B2b3c3e0j

Attachments (3)

38655.diff (1.9 KB) - added by dd32 3 years ago.
38655.2.diff (3.6 KB) - added by dd32 3 years ago.
38655.3.diff (2.3 KB) - added by swissspidy 3 years ago.

Download all attachments as: .zip

Change History (16)

@dd32
3 years ago

@dd32
3 years ago

#1 @dd32
3 years ago

  • Keywords has-patch needs-testing added
  • Milestone changed from Awaiting Review to 4.7

38655.diff makes the dropdown operate as expected, 38655.2.diff also changes the inline edit template so that it doesn't look like WP_Post is an actual post (hint: It's not).

One thing I've noticed is that with this patch, and I don't think it's specific to this implementation, is that when a post doesn't have a template selected (posts OR pages) then the Template dropdown is set to blank, instead of the expected default.

Note for others; original ticket: #18375

#2 @swissspidy
3 years ago

D'oh! Started working on this without realizing that you've already come up with the same solution :-)

#3 @ahortin
3 years ago

@dd32 Just tested these changes and they work. Thanks. And yep, also noticed that other Posts will show blank until they're actually saved again, at which time they'll then show 'Default Template' in the dropdown (if the template wasn't changed)

#4 @bronsonquick
3 years ago

  • Keywords needs-testing removed

Nice work @dd32. I was going to patch this today but you beat me to it!

I've tested this as well and can also confirm it works as expected now!

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


3 years ago

#6 @swissspidy
3 years ago

  • Owner set to swissspidy
  • Status changed from new to assigned

#7 @swissspidy
3 years ago

  • Keywords commit added

#8 @swissspidy
3 years ago

  • Keywords commit removed

One thing I've noticed is that with this patch, and I don't think it's specific to this implementation, is that when a post doesn't have a template selected (posts OR pages) then the Template dropdown is set to blank, instead of the expected default.

Apparently this hasn't been the case in 4.6, so this needs to be fixed as well.

@swissspidy
3 years ago

#9 @swissspidy
3 years ago

38655.3.diff changes get_inline_data() to fix the empty dropdown in Quick Edit.

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


3 years ago

#11 @peterwilsoncc
3 years ago

  • Keywords commit added

LGTM

Confirmed:

  • default shows in template dropdown
  • templates display in quick edit

#12 @dd32
3 years ago

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

In 39210:

Posts, Post Types: Fix Quick Edit to correctly set the page template for non-hierarchical post types.

Props dd32, swissspidy.
Fixes #38655.

#13 @dd32
3 years ago

FYI; changed the patch a bit.

  • I removed the selected() case as it wasn't actually used and didn't appear to make a difference to the outcome
  • I added brackets around the logic in get_inline_data() as it was causing the template tags not to be output as they were being considered part of the expression or the else branch, which resulted in the div element not being printed.
Note: See TracTickets for help on using tickets.