ThemeFuse / Unyson

A WordPress framework that facilitates the development of WP themes
http://unyson.io
926 stars 220 forks source link

Unyson 'Events' Extension #3319

Closed gillianshenml closed 6 years ago

gillianshenml commented 6 years ago

Hi, under my wordpress theme, my Unyson Plugin has an active extension for events. I realised that no matter how I 'post' the events, it does not appear in chronological order or in order of upcoming events. This is rather confusing for people, is there a way that the event posts will sort automatically to show up in order of upcoming events in the page?

You may reference it here: http://pfs.org.sg/events-list/

This happens similarly in my home page where the events come out in a slider, it follows the same arrangement as that in the events page, again not by date of events. Thanks and hope to hear from you!

ViorelEremia commented 6 years ago

We can't add this feature to event extension. Unyson its a plugin with multiple types of options that allow developers of themes to extend these functionalities so if your theme support this feature the theme author must think about of sort them by time event. That is not easy to do but is possible of course with some restrictions for end users. The event data is saved in the database in the format:

                (
                    [0] => Array
                        (
                            [event_date_range] => Array
                                (
                                    [from] => 2018/03/20
                                    [to] => 2018/03/31
                                )

                            [event-user] => Array
                                (
                                )

                        )

                    [1] => Array
                        (
                            [event_date_range] => Array
                                (
                                    [from] => 2018/03/24
                                    [to] => 2018/04/03
                                )

                            [event-user] => Array
                                (
                                )

                        )

                )

you can see here an event which will happen several times what is a big problem because you must extract all posts meta rotating them in cycles to check which is earlier that later but if it will be only one then you can save it into custom save location then you can create a custom query order by meta date. You must ask your theme developer for this feature. If the theme author decides to do that the filter to rewrite default event options fw_ext_events_post_options. Another dirty solution is to change the date of the event post as the date of the event and extract them with sort by date.

gillianshenml commented 6 years ago

i see. thanks for the comprehensive answer.

I'm thinking of trying this" Another dirty solution is to change the date of the event post as the date of the event and extract them with sort by date."

i can definitely change the date of the event post to the date of the event. but what do you mean by extracting them with sort by date?

ViorelEremia commented 6 years ago

Check how they are extracted to the frontend. How you show them into home page for example through the unyson builder or the theme has some options to show them like some templates or metaboxes with options?