Home › Forums › Calendar Products › Events Calendar PRO › : strtotime() expects parameter 1 to be string, object given in on line
- This topic has 4 replies, 2 voices, and was last updated 8 years, 2 months ago by George.
-
AuthorPosts
-
February 8, 2016 at 10:14 am #1069624RexParticipant
Following up on the discussion here (https://theeventscalendar.com/support/forums/topic/warning-strtotime-expects-parameter-1-to-be-string-object-given-in/), this error message is being displayed on all calendar feeds on my site home page. This development site has been posted on two different servers at the following urls:
http://rexchannel.com/wp_dev/index.php
http://053.f42.myftpupload.com/index.phpThe error DOES NOT occur in my local development environment. The complete error message is:
: strtotime() expects parameter 1 to be string, object given in on line
Warning/home/content/p3pnexwpnas04_data01/66/2773966/html/wp-content/plugins/the-events-calendar/src/Tribe/Query.php217
Here is an example of the code I used to create the calendar feeds:
<?php global $post; // retrieve the next 5 upcoming events $events = tribe_get_events( array( 'start_date' => new DateTime(), 'tribe_events_cat' => 'services' ) ); foreach ( $events as $post ) { setup_postdata( $post ); echo '<div class="event_item">'; echo '<div class="event_date">' . tribe_get_start_date() . '</div>'; echo '<h4><a href='.get_the_permalink() . '>' . get_the_title() . '</a></h4>'; echo '</div>'; } ?>
Updating to the latest version of The Events Calendar has had no effect on the problem.
Thanks in advance for your help!
February 8, 2016 at 10:24 am #1069634RexParticipantIt seems that in an effort to remove comments from my code, I accidentally removed a line. Here is the corrected code:
<?php global $post; $events = tribe_get_events( array( 'posts_per_page' => 10, 'start_date' => new DateTime(), 'tribe_events_cat' => 'services' ) ); foreach ( $events as $post ) { setup_postdata( $post ); echo '<div class="event_item">'; echo '<div class="event_date">' . tribe_get_start_date() . '</div>'; echo '<h4><a href='.get_the_permalink() . '>' . get_the_title() . '</a></h4>'; echo '</div>'; } ?>
February 8, 2016 at 10:50 am #1069646GeorgeParticipantHey @Rex,
Thanks for posting your code here. I’m wondering if changing the ‘start_date’ argument in your use of tribe_get_events() alone might help here–try this instead of your current use of new DateTime():
'start_date' => current_time( 'Y-m-d' ),
Let me know if this helps!
George
February 8, 2016 at 11:15 am #1069660RexParticipantYES! This fixed the problem. Thank you so much for your quick response.
Rex
February 8, 2016 at 1:20 pm #1069759GeorgeParticipantNice! Best of luck with your site 🙂
— George
-
AuthorPosts
- The topic ‘: strtotime() expects parameter 1 to be string, object given in on line’ is closed to new replies.