ventatto
Forum Replies Created
-
Forum: Developing with WordPress
In reply to: parse_query() orderby date ignoring yearI can’t see what you mean by doing something like
ORDER BY MONTH( post_date )… However, I found a way to address my problem here and adapted it. It still does not work but I’d like to know if it’s in the right direction.add_filter( 'posts_orderby', 'birthday_sort', 10, 2 ); function birthday_sort( $orderby, $query ) { if ( ! is_admin() && 'post_date' === $query->get( 'orderby' ) ) { global $wpdb; $order = ( 'ASC' === strtoupper( $query->get( 'order' ) ) ) ? 'ASC': 'DESC'; // This means, we still sort by the date, but we "recreate" the date using // the year 2020 (or any leap year), and month and day from the meta value. $orderby = "STR_TO_DATE( CONCAT( '2020-', MONTH( {$wpdb->postmeta}.meta_value ), '-', DAY( {$wpdb->postmeta}.meta_value ) ), '%Y-%m-%d' ) $order"; } return $orderby; } add_action( 'pre_get_posts', 'birthday_orderby_meta' ); function birthday_orderby_meta( $query ) { $orderby = $query->get( 'orderby'); if( 'post_date' == $orderby ) { $query->set('meta_key','post_date'); $query->set('orderby','meta_value'); } }Forum: Developing with WordPress
In reply to: parse_query() orderby date ignoring yearYes my posts are dated with the person’s birthday. About your suggestion, I don’t see how to break the date before calling
get_posts($args). My only thought would have been to usedate_querybut I can’t break the date with that…Forum: Plugins
In reply to: [SportsPress - Sports Club & League Manager] Filter events (blocks/list) liveHi,
Alright, hope a developer can give me further help. By the way, I saw a link to a Slack community for developers but it does not work… is it normal ?
Thanks,
TomForum: Plugins
In reply to: [SportsPress - Sports Club & League Manager] Filter events (blocks/list) liveHi,
Yeah I know, but I just wanted to know in which file and/or function I could add appropriated custom code for that idea.
Thanks again,
TomGreat I found something similar to this but yours is better organized. Thanks for your help !
Above all for event blocks. If I can then apply it to event list it would be a good point as well.
Thanks @savvasha !
Hi @corrinarusso, it indeed does not appear in the output of an event. But I think it’s a great feature to filter events so I want to profit from it by setting events’ background color consequently.
Hi,
Ok. Can you just tell me then in which document I can add similar classes to
sp-template-event-blocks?Thanks,
TomSince I can now test my ical feed, I have a better solution @bartvanbelle ! Here you can see only modifications to
feeds/ical.phpwhich means that no modifications tomodules/sportspress-bulk-actions.phpis needed anymore and therefore the event title won’t be modified.You are great ! All is back on.
Thanks a lot
Hey @bartvanbelle,
I just found a temporary solution for changing event title depending on event status from bulk actions. It is not an optimal solution but it works in this case (status is either cancelled or postponed). If you want to switch back to “On time” status, you must do it on the event edit page and probably change manually the title.
Forum: Developing with WordPress
In reply to: Post title and date conflict in wp_insert_post()I didn’t even think to use
get_post()! Now it’s working and code is way simpler. I also changed my variable name :).Thanks for the tip !
I just gave it a try but without success.
Thanks for your help,
TomIndeed I have just checked and it’s the same when I create a new calendar… It seems that there is a problem with this. Can you give support here or do you prefer that I create a new topic ?
Thanks in advance,
TomFor sure ! However, I have a problem with testing my solution because it’s been a few days that I no longer have access to my ical links ? I am told that
There was an error subscribing to the calendar.
for instance :
A calendar wasn’t found on webcal://www.saintlouisbasket.be/calendar/r1-20-21?feed=sp-ical. Check the URL.
Do you have an idea by the way ?