Display Event Start Date

Filipe created the topic: Display Event Start Date

Hello, in my site I must have a function showing all events in a list, I was able to show the event title by the folowing code, but how do I show the event start date?

The code I'm using:

<?php
  $the_query2 = new WP_Query('post_type=ecwd_event&posts_per_page=7');
   while ($the_query2->have_posts()) :
	   $the_query2->the_post();
 ?>
	<li>
		<i class="fa fa-angle-double-right"></i>
		<a href="<?php the_permalink(); ?>">
			<?php echo get_the_title(); ?>
		</a>
	</li>
<?php endwhile; wp_reset_postdata();	 ?>

Tanks for the help!!!

#28539

Please Log in or Create an account to join the conversation.


Support replied the topic: Display Event Start Date

Dear Filipe,

Please use the following code instead:

<?php
    $the_query2 = new WP_Query('post_type=ecwd_event&posts_per_page=7');
    while ($the_query2->have_posts()) :
    $the_query2->the_post();
    $start_date = get_post_meta(get_the_ID(), 'ecwd_event_date_from', true);
    $end_date = get_post_meta(get_the_ID(), 'ecwd_event_date_to', true);
?>
<li>
    <i class="fa fa-angle-double-right"></i>
    <a href="<?php the_permalink(); ?>">
        <?php echo get_the_title(); ?>
    </a>
</li>
<?php endwhile; wp_reset_postdata(); ?>

Thank you.


Best regards,
Web-Dorado team


Joomla extensions ,
Wordpress plugins ,
Drupal modules
#28569

Please Log in or Create an account to join the conversation.


Filipe replied the topic: Display Event Start Date

Thanks for the reply, the code worked just fine, but I want do display only the date in the d/m/y format, the code you sent is displaying the hour too.


Thanks a lot!

#28619

Please Log in or Create an account to join the conversation.


Support replied the topic: Display Event Start Date

Dear Filipe,

Here's the necessary code:

$start_date = get_post_meta(get_the_ID(), 'ecwd_event_date_from', true);
$start_date = date('d/m/y', strtotime($start_date));

Please implement the same for end date.
Thank you.


Best regards,
Web-Dorado team


Joomla extensions ,
Wordpress plugins ,
Drupal modules
#28665

Please Log in or Create an account to join the conversation.


Filipe replied the topic: Display Event Start Date

Last question, how do I order the loop by this date?

Thanks for the help!

#28709

Please Log in or Create an account to join the conversation.


Support replied the topic: Display Event Start Date

Dear Filipe,

Please write the following instead of your query:

$the_query2 = new WP_Query('post_type=ecwd_event&posts_per_page=7&order=ASC&orderby=meta_value&meta_key=ecwd_event_date_from');

Thank you.


Best regards,
Web-Dorado team


Joomla extensions ,
Wordpress plugins ,
Drupal modules
#28761

Please Log in or Create an account to join the conversation.


Filipe replied the topic: Display Event Start Date

You are awesome, everything worked just fine.

Thanks a lot for the fast reply and the attention!

#28809

Please Log in or Create an account to join the conversation.


Support replied the topic: Display Event Start Date

Dear Filipe,

Thank you for your kind feedback. Please feel free to let us know in case you have any other questions.
Thank you.


Best regards,
Web-Dorado team


Joomla extensions ,
Wordpress plugins ,
Drupal modules
#28811

Please Log in or Create an account to join the conversation.


Time to create page: 0.209 seconds
Powered by Kunena Forum

WORLD-CLASS SUPPORT

We are here for you every step of the way. Turn to our support with any questions you might have about our products and services. Our experienced customer care team is available to help you as fast as we possibly can.

Contact us