WordPress.org

Make WordPress Core

Opened 17 months ago

Last modified 17 months ago

#39607 new enhancement

Multiple pages with the same title but different parents not differentiated in link editor dialog

Reported by: jdgrimes Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.8
Component: Editor Keywords: has-patch 2nd-opinion
Focuses: ui Cc:

Description

Linking to another page/post on the site is made easy by the link editor dialog, which displays a list of matching items. The type of post each item is is shown on the right, so it is easy to tell the difference between multiple items with the same name if they are different post types. However, sometimes with hierarchical post types like pages there are multiple items with the same title, but different parents. There is no way to tell them apart. (See attached image.) It would be helpful if in this case the parent of the page was also shown.

Attachments (2)

link editor dialog multiple pages same title.png (12.1 KB) - added by jdgrimes 17 months ago.
Example of this issue
39607.diff (768 bytes) - added by bor0 17 months ago.

Download all attachments as: .zip

Change History (7)

#1 @apmarshall
17 months ago

+1 for this.

A couple of possible permutations for posts with a parent. First, we could show as breadcrumbs in the link dialogue like so: Parent-1>Events Parent-2>Events

or, we could create a center column that listed the parent of a page: Events | Parent: Parent-1 | Page Events | Parent: Parent-2 | Page

Other ideas?

@bor0
17 months ago

#2 @SergeyBiryukov
17 months ago

Previously: #15603, which got closed as a duplicate of #13499, but never addressed there.

#3 @SergeyBiryukov
17 months ago

  • Keywords has-patch added

#4 follow-up: @azaozz
17 months ago

  • Keywords 2nd-opinion added

Looking at 39607.diff: can we do something like:

$parent_id = wp_get_post_parent_id( $post->ID );

if ( $parent_id ) {
   ....
}

Seems more readable.

Also, not sure the parent title should be after the post title. Doesn't seem logical and is the opposite in the permalink.

Also, what do we do for grandparents, great-grandparents, etc. Should we skip them? Perhaps go to three levels deep?

In any case, needs some feedback on how to display:

Paten title / Post title
Grandparent title / Parent title / Post title

(Separating them with slashes seems good as it resembles the URL structure.)

Last edited 17 months ago by azaozz (previous) (diff)

#5 in reply to: ↑ 4 @jdgrimes
17 months ago

Replying to azaozz:

Also, not sure the parent title should be after the post title. Doesn't seem logical and is the opposite in the permalink.

I as originally thinking that the parent title would be after, because the part you are searching for should come first. What if the title(s) are long and the end has to be cut off? (I'm not sure how that is handled here.) The parent title should probably be clipped, not the child.

Also, what do we do for grandparents, great-grandparents, etc. Should we skip them? Perhaps go to three levels deep?

Originally I had thought that the parent would only need to be shown when multiple items shared the same title. If we did that, then I guess it would only make sense to show the grandparents if the parents were also the same. But perhaps it is better to always show the parents, maybe there are other times that is helpful, even when titles don't match exactly??

In any case, needs some feedback on how to display:

Assuming that the parent was shown second, I was thinking something along the lines of:

Child title < Parent Title

I envisioned that the parent title would be in a slightly lighter/less bold color than the child title, so as not to distract from the child so much. That would probably be especially good if the parent is always shown for every item, and not just for ambiguous ones.

Note: See TracTickets for help on using tickets.