How to remove Year from start date with multi day event occurs in the same year

WordPress Event Management, Calendars & Registration Forums General Question How to remove Year from start date with multi day event occurs in the same year

This topic contains 2 replies, has 2 voices, and was last updated by  Alicia St Rose 10 years, 7 months ago.

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

    I have a site I’m developing that promotes multi-day retreats.
    On the single event page the date reads:

    December 12, 2013 thru December 17, 2013

    Is there any way to remove the first occurence of the year so that it reads:

    December 12 thru December 17, 2013?

    Thanks so much!

    Alicia St Rose
    #7386

    Hi Alicia,

    Yes :

      //Set up formats
      $format_with_year  = 'F d, Y';
      $format_without_year  = 'F d';
    
      //Set format according to whether the event starts and ends in the same year or not:
      $format = ( eo_get_the_start('Y') == eo_get_the_start('Y') ? $format_without_year: $format_with_year );
    
      echo eo_get_the_start( $format ) . ' thru ' . eo_get_the_end( $format_with_year );
    

    (I’ve assumed here ‘multiday’ meant long-day, but if you meant a recurring event, a similar method can be used).

    Stephen Harris
    #7436

    It was for a long day event and it worked perfectly!

    Thank you so much!

    Alicia St Rose
Viewing 3 posts - 1 through 3 (of 3 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.