Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #487204

    Dear enfold-enthousiasts,
    I have installed the plugin ‘Event Organiser’ which basically provides a new event post-type. The main feature is that it provides me start and end dates. I modified the postslider.php already in a way, that the post slider elements don’t show the creation/publish time of the event but the actual start date in the meta section. On top of that, I would like to order the events with respect to those start dates. I already added the function avia_custom_query_extension (I found it somewhere in the forums/documentation) and have now the option to choose between different sorting options. I know that you probably won’t have experiences with the particular plugin I use, but does somebody have experience, where and how to define a new order-item?
    In a similar way to what was given in the fuction code, I tried to add a simple line like __('Event Date', 'avia_framework' ) =>'start') to the mentioned function, but this doesn’t work. I guess I have to define this ordering item somewhere else… but where? I would appreciate any hint!
    I can also give more information if needed…

    Thank you in advance!

    Sebastian

    #487330

    Hi Sebastian!

    I don’t think that is going to be possible. See here for the available sorting options with WordPress, https://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters.

    If the date was added in a custom field then you could try using the “meta_value” or “meta_value_num” options but I don’t think it would know how to sort by a date that way.

    I would try asking in the WordPress support forums or contact a freelancer to see if it’s possible.

    Best regards,
    Elliott

    • This reply was modified 9 years, 2 months ago by Elliott.
    #487360

    Thank you Elliott!
    This actually helped a lot :) Maybe this will help somebody else in the future, so I document a little bit:
    I added a custom field ‘event_date’ in the format ‘yymmddhhmm’ and then sort as you indicated with “meta_value_num”. This works!
    The only open problem was about recurrung events. So I added a piece of code to update this meta field with
    update_post_meta( $post_id, 'event_date', $the_next_date );
    where $the_next _date is filled with the event specific meta information. This is called every time the post content is retrieved, so I keep sure that also in recurring events this information is always up to date. And it seems to work nicely.
    It is of course a bit dirty, but I’m fine with it :)

    Thank you again!

    Cheers,
    Sebastian

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘post slider custom ordering’ is closed to new replies.