Support

Home Forums Event Espresso Premium Payment timestamp to only show date

Payment timestamp to only show date

Posted: October 15, 2018 at 3:51 pm


renefi

October 15, 2018 at 3:51 pm

Hi, I want the [PAYMENT_TIMESTAMP] to only show the date, not the time. I use it in the invoice and I don’t want the time there. I cannot find where to edit that. Can you provide some help on that.
Thank you
Rene


renefi

October 15, 2018 at 5:43 pm

I found a solution…


Josh

  • Support Staff

October 15, 2018 at 6:14 pm

Please do share your solution.


renefi

October 15, 2018 at 6:30 pm

You are right… I used a very simply work around. In the wp settings I just blanked out the time format field. This way no time is shown anywhere on the page. That is fine. I didn’t want that anyway. Just one strange thing appeared in the event listings. Where the time should have been displayed an extra set of dates appeared. I hide that with css now

.ee-event-datetimes-li-timerange { display: none;}

There might be a cleaner solution for sure 🙂


Josh

  • Support Staff

October 15, 2018 at 9:46 pm

Hi,

I think you’ll find some other issues with blanking out the WordPress Settings time format field.

What you can do is add a new [PAYMENT_DATE] shortcode that outputs the date alone. Example code follows:

add_filter( 
  'FHEE__EE_Shortcodes__shortcodes', 
  'register_new_payment_date_shortcode', 
  10, 
  2 
);

function register_new_payment_date_shortcode( 
  $shortcodes, 
  EE_Shortcodes $lib 
) {
  if ( $lib instanceof EE_Payment_Shortcodes ) {
    $shortcodes['[PAYMENT_DATE]'] = _('The date of the payment');
  }
  return $shortcodes;
}

add_filter( 
  'FHEE__EE_Shortcodes__parser_after', 
  'register_new_payment_date_shortcode_parser', 
  10, 
  5 
);

function register_new_payment_date_shortcode_parser( 
  $parsed, 
  $shortcode, 
  $data, 
  $extra_data, 
  EE_Shortcodes $lib 
) {
  if ( $lib instanceof EE_Payment_Shortcodes && $data instanceof EE_Payment ) {
    if ( $shortcode == '[PAYMENT_DATE]' ) {
      return date_i18n(
        get_option('date_format'), 
        strtotime($data->timestamp())
      );
    }
  }
  return $parsed;
}

You can add the above to a functions plugin. Then after you activate the plugin you can add [PAYMENT_DATE] to the invoice template where you want the date of payment displayed.


EbeciaConnect

October 30, 2018 at 3:52 am

How do I make this shortcode available to the “Main Content” of the Receipt Template?
Currently it’s only available to the [PAYMENT_LIST] section.


Tony

  • Support Staff

October 30, 2018 at 9:35 am

Hi @ebeciaconnect

I replied to your thread here:

https://eventespresso.com/topic/payment-date-on-top-of-receipt-instead-of-registration-date/

The support post ‘Payment timestamp to only show date’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso