WordPress.org

Make WordPress Core

Opened 9 months ago

Last modified 3 months ago

#39599 new enhancement

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

Reported by: 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 9 months ago.
39599.diff (3.9 KB) - added by Presskopp 4 months ago.
customizer.jpg (35.3 KB) - added by Presskopp 4 months ago.
pages.jpg (43.6 KB) - added by Presskopp 4 months ago.
39599.patch (3.5 KB) - added by ajayghaghretiya1 4 months ago.

Download all attachments as: .zip

Change History (17)

#1 @karmatosed
9 months 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
9 months 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
9 months 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
9 months 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
9 months ago

#5 @SergeyBiryukov
9 months ago

  • Description modified (diff)

#6 in reply to: ↑ 2 @SergeyBiryukov
9 months 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
4 months ago

#7 @Presskopp
4 months 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
4 months ago

@Presskopp
4 months ago

#8 @ajayghaghretiya1
4 months ago

I have attached the patch of this issue.

#9 @Presskopp
4 months ago

  • Keywords has-patch added

#11 @afercia
3 months 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
3 months 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.