Make WordPress Core

Opened 8 years ago

Last modified 7 years ago

#39599 new enhancement

Customizer: when no title on page it adds weird content in navigation link

Reported by: karmatosed's profile karmatosed Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Customize Keywords: has-patch
Focuses: Cc:

Description (last modified by SergeyBiryukov)

I understand that that there may need to be a title, however if you have a page and remove the title you then get the following:

https://cldup.com/sc4tmiokFB.png

The output being #20 (no title) does make sense but couldn't we increase the usability here and just have it say 'no title'? Do we have to have #20?

Attachments (5)

ID.jpg (26.9 KB) - added by Presskopp 8 years ago.
39599.diff (3.9 KB) - added by Presskopp 7 years ago.
customizer.jpg (35.3 KB) - added by Presskopp 7 years ago.
pages.jpg (43.6 KB) - added by Presskopp 7 years ago.
39599.patch (3.5 KB) - added by ajayghaghretiya1 7 years ago.

Download all attachments as: .zip

Change History (17)

#1 @karmatosed
8 years ago

  • Summary changed from Customizer: when no title on page it adds weird content to Customizer: when no title on page it adds weird content in navigation link

#2 follow-up: @Presskopp
8 years ago

This is coded as '#%d (no title)' and we have 7 occurences in 5 files. The #%d is the ID of the post. It's not so weird to me, but maybe we should replace # by ID:. If we'd just cut it, what if there are more untitled posts?

#3 @lukecavanagh
8 years ago

@Presskopp

Depends on which type of user is seeing that in the customizer. It is not directly obvious that it is the post id then displaying no title. Or does it make sense to make post or page title be required to be able to save either?

#4 @Presskopp
8 years ago

I don't know what's the perfect solution. I assume the easiest way would be forcing the user to enter a name for any post/page - so we don't need to worry about such anymore (What's the benefit of having a nameless post besides testing purposes?). But as long as we do, here some possible permutations:

ID:20 (no title)
ID:20 (untitled)
(no title, ID:20)
(no title) [ID:20]
...

We could also display a helping text when an untitled post/page is detected - see screenshot

Better ideas welcome! :)

@Presskopp
8 years ago

#5 @SergeyBiryukov
8 years ago

  • Description modified (diff)

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

Replying to Presskopp:

This is coded as '#%d (no title)' and we have 7 occurences in 5 files.

Related:

  • [24560], #23254 for wp_setup_nav_menu_item() and Walker_Page::start_el().
  • [27360], #27218 for Walker_PageDropdown::start_el().
  • [38618], #38015 for WP_Customize_Nav_Menu_Item_Setting::get_original_title().

@Presskopp
7 years ago

#7 @Presskopp
7 years ago

Here's a patch, see screenshots please. Still needs agreement on the wording and would need version comment in function _draft_or_post_title of template.php

@Presskopp
7 years ago

@Presskopp
7 years ago

#8 @ajayghaghretiya1
7 years ago

I have attached the patch of this issue.

#9 @Presskopp
7 years ago

  • Keywords has-patch added

#11 @afercia
7 years ago

I'm not sure the post ID would help so much the average user. It might be useful in the admin/Customizer context but advanced users would already know how to retrieve the post ID. As a site owner, probably I wouldn't want to see that number on my front-end.

Worth noting #35709 just removed the post ID number from the Recent Posts widget, which is now displaying just (no title). @westonruter any thoughts?

#12 @westonruter
7 years ago

Given that this is an admin context, it makes more sense for an ID to be shown. But it would be even better if we grabbed the first few words of the excerpt or content to use as the snippet. In fact, that would probably be what we should do for #35709 as well. This is essentially what O2 does: https://github.com/Automattic/o2/blob/007c733/inc/write-api.php#L93-L94

Note: See TracTickets for help on using tickets.