Support

Home Forums Event Espresso Premium Display both dates in widget

Display both dates in widget

Posted: May 13, 2013 at 3:11 pm


A J

May 13, 2013 at 3:11 pm

Hello,

How do I go by displaying both the dates if the event I’m having is happening on two concurrent days? Right now the widget is only displaying the date the event begins.

For example, I want it to look like:

Training Course – May 24 – 25, 2013

http://www.webpagescreenshot.info/img/5191400fa15231-24542763


Dean

May 14, 2013 at 5:08 am

Hi,

You would have to edit the idget code a little bit.

Start by copying the widegt.php file (found in event-espresso/templates) to wp-content/uploads/espresso/templates.

There edit the file and look for the following line

<p><a href="<?php echo $registration_url; ?>"><?php echo stripslashes_deep($event->event_name) ?> - <?php echo event_date_display($event->start_date) ?></a>

It should be on line 129. Then edit ti to show something like this

<p><a href="<?php echo $registration_url; ?>"><?php echo stripslashes_deep($event->event_name) ?> - <?php echo event_date_display($event->start_date) ?> to <?php echo event_date_display($event->end_date) ?></a>

That will make the widget show this http://d.pr/i/Bzn9


A J

May 14, 2013 at 6:32 am

Dean,

Your the man, thanks!


A J

May 14, 2013 at 6:46 am

By the way, what function would I have to call in order to pull the venue name for this event?

Also, how do I get access to the rest of the functions, similar to what you have above? It would make it much easier for me to customize this on my own.


Dean

May 14, 2013 at 11:35 pm

Hi,

This is best done on a test site/local site, but if you add var_dump($event); to the template and refresh the page it will show what is available in the $event array.

You can also use the PHP get current variables, to find out what variables are available at that point, http://php.net/manual/en/function.get-defined-vars.php.

Using that for example, I know that the venue data isnt available on the home page of my site, so I would probably have to do an sql query to make sure that data is available for the widget, as there is no function for it in 3.1.X its just a database call.

Hope that helps.


A J

May 20, 2013 at 2:47 am

Dean,

How do I change the date format from the one you provided to the standard 05/20/13 format?


Dean

May 20, 2013 at 3:03 am

Hi,

All dates in Event Espresso are controlled by WordPress, in the General settings.

If you want the dates to be different here, you would need to use the php date function,

eg

<?php $test = event_date_display($event->start_date); echo date('Y-m-d', strtotime($test)); ?>

http://php.net/manual/en/function.date.php

The support post ‘Display both dates in widget’ 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