вторник, 3 февраля 2015 г.

WORDPRESS post_type tribe_events orderby

After a long seeking and learning (and I am not wp expert), I found an ultimate solution for this Modern Tribe plugin.
The problem is, that the plugin wants you to use their function to get the posts, but what if you want to have the post inside the main query - this enables you to use the have_posts().
And when you try to set your orderby for that query - it doesn't change.

So, here is the best solution you will find all over the net -
You should update the main class function in lib/tribe-event-query.class.php:
somewhere in line 619, there is a switch for the orderby arg, add your custom case to that switch for example:

case 'EventStartDate':
     $order_sql = "EventRating ASC, " . $order_sql;
break;


Then your
query_posts(array('post_type'=> 'tribe_events','orderby' => 'EventRating',  .....

WILL FINALLY WORK





Комментариев нет:

Отправить комментарий