Skip Navigation

[Closed] Order Post

This support ticket is created 10 years, 5 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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)

This topic contains 1 reply, has 2 voices.

Last updated by Luo Yang 10 years, 5 months ago.

Assigned support staff: Luo Yang.

Author
Posts
#21516

Hi, i got an event website and i ordered posts in a view by event date, when it shows the articles with the same date it orders them by post date. I'd like to set a priority field and have the possibility to order it by the 2 conditions like:
EVENT ordered by FIELD DATE AND ordered by FIELD PRIORITY.

In filters i can't add this type of condition. Is there a solution?

#21565

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Hi Alessandro,

Could you try use WP filter posts_orderby, add some PHP code in your theme/functions.php, like this
add_filter('posts_orderby', 'my_event_order', 10, 2);
function my_event_order($order, $q) {
if (in_array('event', (array)$q->get('post_type'))) {
$order = 'my_date_field, my_custom_field';
}
return $order;
}

Please replace event, my_date_field, my_custom_field with the your custom post slug and custom fields slug

More help: http://codex.wordpress.org/Plugin_API/Filter_Reference/posts_orderby

Regards
Luo

The topic ‘[Closed] Order Post’ is closed to new replies.