quentinp
Forum Replies Created
-
I’ve been sending with MailPoet for 4 or 5 years and have never had this problem – I know that doesn’t help you but I want others to know this is rare, if it is Mailpoet that’s the issue. GOod luck.
Awesome, thanks
QI did a simple key like this, copying the color# from the category color picker
<span style="color: white; background-color: #14402b;">Sustainable Wellesley Event</span> <span style="background-color: #90df93;">Wellesley Green Schools</span> <span style="background-color: #dff676;">Farmers' Market</span> <span style="color: white; background-color: #c53726;">Not a Sustainable Wellesley Event</span> </span>
OK, thanks.
QResolved above
“To get the format you want, either change the format under the Settings menu or “
THIS DOES NOT WORK. I did do that before I even started this post (I said it was easy, but not THAT easy), then it was suggested once in the thread above already and I pointed out it didn’t work. Changes to those settings do not reach the page.
However, I think I worked out the problem
In a post further up I stated:
both
<?php echo date(“h:i A”, $EM_Event->start_time);?>
<?php echo date(“h:i A”, $EM_Event->event_start_time);?>
Return 12:00 AM (and 19 seconds)and
<?php echo $EM_Event->start_time;?>
<?php echo $EM_Event->event_start_time;?>
Return
19:00:00I think I need to be defining a time format somewhere else?
The answer is not defining it somewhere else, but with something else. My code was using ‘start_time’ when it seems should have been using ‘start’ (ditto end_time). Not sure why, and I don’t care, but maybe this matters to someone else/ the developers.
The following code works – provides 12h clock WITH the correct time (not 12 am and 19 seconds):
<div class="time-area"> <strong class="time"> <!/strong> <!strong class="date"> <?php echo date("h:i a ",$EM_Event->start);?> <?php echo 'to '?> <?php echo date("h:i a",$EM_Event->end);?> <br><?php echo date(" l F jS Y",$EM_Event->start);?> </strong> </div>
Produces:
7:00 pm to 9:00 pm
Saturday September 17th 2015I was wrong in the first post – I am editing not event.single.php, but single-event.php
This includes the following:
<div class="time-area"> <strong class="time"> <?php echo $EM_Event->event_start_time;?> <?php echo 'to'?> <?php echo $EM_Event->end_time;?> <!/strong> <!strong class="date"> <?php echo date(get_option('date_format'),$EM_Event->start);?> </strong> </div>
and it is this that is returning the frustrating format. Here is an example of an event that shows 24hr format
https://www.sustainablewellesley.com/events/plastics-what-to-do/As noted above various options are not working.
$EM_Event I understand is an object defined by Events Manager as standard. It is referred to earlier in that file. I really don’t know if this is relevant, but the following is included:global $post,$EM_Event; // Get Post Meta Elements detail $event_social = ''; $sidebar = ''; $left_sidebar = ''; $right_sidebar = ''; $event_thumbnail = ''; $video_url_type = ''; $select_slider_type = ''; $event_detail_xml = get_post_meta($post->ID, 'event_detail_xml', true); if($event_detail_xml <> ''){ $cp_event_xml = new DOMDocument (); $cp_event_xml->loadXML ( $event_detail_xml ); $event_social = find_xml_value($cp_event_xml->documentElement,'event_social'); $sidebar = find_xml_value($cp_event_xml->documentElement,'sidebar_event'); $left_sidebar = find_xml_value($cp_event_xml->documentElement,'left_sidebar_event'); $right_sidebar = find_xml_value($cp_event_xml->documentElement,'right_sidebar_event'); $event_thumbnail = find_xml_value($cp_event_xml->documentElement,'event_thumbnail'); $video_url_type = find_xml_value($cp_event_xml->documentElement,'video_url_type'); $select_slider_type = find_xml_value($cp_event_xml->documentElement,'select_slider_type'); }
The file that angelo refers to – classes/em-event.php – seems to define $EM_Event including the following:
/** * Event Object. This holds all the info pertaining to an event, including location and recurrence info. * An event object can be one of three "types" a recurring event, recurrence of a recurring event, or a single event. * The single event might be part of a set of recurring events, but if loaded by specific event id then any operations and saves are * specifically done on this event. However, if you edit the recurring group, any changes made to single events are overwritten. * * @author marcus */ class EM_Event extends EM_Object{ /* Field Names */ var $event_id; var $post_id; var $event_slug; var $event_owner; var $event_name; var $event_start_time; var $event_end_time;
Does this help at all??
OK, maybe this is harder than I thought. The admin option through the normal interface has time format of:
“g:i a
For use with the #_EVENTTIMES placeholder”I think that’s the part you’re referring to. If I thought it was as simple as using that placeholder I/we would have started there. The lines you point to in em-event.php are
case '#_EVENTTIMES': //get format of time to show if( !$this->event_all_day ){ $time_format = ( get_option('dbem_time_format') ) ? get_option('dbem_time_format'):get_option('time_format'); if($this->event_start_time != $this->event_end_time ){ $replace = date_i18n($time_format, $this->start). get_option('dbem_times_separator') . date_i18n($time_format, $this->end); }else{ $replace = date_i18n($time_format, $this->start); } }else{ $replace = get_option('dbem_event_all_day_message'); } break;
But I don’t see how this helps. dbem_time_format is referred to only here in this file and in the booking section.
I don’t want this to go on forever – please review my second post: the number being returned appears to be ’19’ – which is correct for the number of hours. But I want this formatted 12H clock. If I do the date formatting as shown it interprets the 19 as 19 seconds. I am a complete novice, but it seems to me that the answer is here somewhere.
This is not as simple as picking the right time format – it’s knowing WHERE to select it for this use of start_time. And we don’t know that yet.
Thanks for sticking with this.
Thanks! I found the file classes/em-event.php
It does have
var $event_start_time;
and also the line
'event_start_time' => array( 'name'=>'start_time', 'type'=>'%s', 'null'=>true ),
All other (25 of) instances of ‘start_time’ seem to be logic or other uses – nothing that defines the time format. So if this file is the answer, what do I do with it?
Many thanks
QuentinThat also returns 12:00 AM
both<?php echo date("h:i A", $EM_Event->start_time);?> <?php echo date("h:i A", $EM_Event->event_start_time);?>
Return 12:00 AM
and
<?php echo $EM_Event->start_time;?> <?php echo $EM_Event->event_start_time;?>
Return
19:00:00I think I need to be defining a time format somewhere else?
Thanks, but this line:
<?php echo date("h:i A", $EM_Event->start_time);?>
Returns:
12:00 AMBecause it is interpreting the start_time as 19 seconds – which rounds down to less than one minute, therefore 12am. The actual start time is 19.00 hours, and without the date() formatting it shows this correctly, I just want it in a 12 hour clock.
OK, I’m getting closer. If I do this:
<?php echo date("D F Y g i s a", $EM_Event->start_time);?>
Then I can format the output but the object is returning is returning just “19” (as 7pm) and date() is interpreting this as 19 seconds, so the above gives:
Thu January 1970 12 00 19 am
I don’t want to format it by subtracting 12 and simply outputting the number and calling it hours, or doing an if-greater-than-12-subtract-12 if I can avoid it. The alternative:
<?php echo $EM_Event->start_time;?>
gives:
19:00:00 October 12, 2015
Which is correct, but 24 hour format which I don’t want…..
I found event-single.php and all it includes is this:
global $EM_Event;
/* @var $EM_Event EM_Event */
echo $EM_Event->output_single();
?>But then I found single-event.php and renamed it and I think that’s it.
Just let me know if I got something wrong.
Many thanks
QForum: Plugins
In reply to: [Plugin: Events Manager] Register button is and is not presentP.S.
Default event list format:
‘<tr>
<td>
#_EVENTDATES
#_EVENTTIMES
</td>
<td>
#_EVENTLINK
{has_location}
<i>#_LOCATIONNAME, #_LOCATIONTOWN #_LOCATIONSTATE</i>{/has_location}
</td>
</tr>’Single Page event format:
‘<div style=”float:right; margin:0px 0px 15px 15px;”>#_LOCATIONMAP</div>
<p>
Date/Time
Date(s) – #_EVENTDATES
<i>#_EVENTTIMES</i>
</p>
{has_location}
<p>
Location
#_LOCATIONLINK
</p>
{/has_location}
<p>
Categories
#_CATEGORIES
</p>
<br style=”clear:both” />
#_EVENTNOTES
{has_bookings}
<h3>Bookings</h3>
#_BOOKINGFORM
{/has_bookings}’