Skip Navigation

[Resolved] Sort by parent’s title

This thread is resolved. Here is a description of the problem and solution.

Problem:

In a post view, querying child posts, the client is going to order the result by parent post title.

Solution:

Unfortunately, there isn't such a built-in feature, you can only order the result by fields of the child posts, you can not order the result by fields of other post type.

This is a wordpress limitation

Relevant Documentation:

https://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters

This support ticket is created 6 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

Tagged: 

This topic contains 2 replies, has 2 voices.

Last updated by randallH-3 6 years, 6 months ago.

Assisted by: Luo Yang.

Author
Posts
#950811
[wpv-layout-start]
	[wpv-items-found]
	<!-- wpv-loop-start -->
	<table width="100%">
		<thead>
			<tr>
             	<th>Thumbnail</th>
				<th>Title</th>
             	<th>Type</th>
				<th>Notes</th>
			</tr>
		</thead>
		<tbody class="wpv-loop js-wpv-loop">
		<wpv-loop>
          [wpv-conditional if="( '[wpv-current-user info='login']' eq '[types field='note-user'][/types]' )"]
			<tr>
             	<td>[wpv-post-featured-image id="$proof-point"]</td>
       			<td>[wpv-post-link id="$proof-point"]</td>
          		<td>[wpv-post-type show="single" id="$proof-point"]</td>
          		<td>[cred_form form='edit-note']</td>
			</tr>
          
          [/wpv-conditional]
		</wpv-loop>
		</tbody>
	</table>
	<!-- wpv-loop-end -->
	[/wpv-items-found]
	[wpv-no-items-found]
		<strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
	[/wpv-no-items-found]
[wpv-layout-end]

How can I create sort by parent's title? Is it possible?

#951183

Hello,

I assume we are talking about a post view, querying child posts, you are going to order the result by parent post title.
If it is, unfortunately, there isn't such a built-in feature, you can only order the result by fields of the child posts, you can not order the result by fields of other post type.

This is a wordpress limitation, see document:
https://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters

#951649

Thank you.