Support

Home Forums Event Espresso Premium Get event date and time

Get event date and time

Posted: July 1, 2015 at 10:44 am


Su Yuen Chin

July 1, 2015 at 10:44 am

Hi,

I added following code to add Open Graph Meta Data to header. Can you tell me how to get the date and time? Thank you.


function insert_ogmeta_in_head() {
  echo '<meta property="og:description" content="Date: (date of event), Time: (time of event)"/>';
}
add_action( 'wp_head', 'insert_ogmeta_in_head', 5 );


Lorenzo Orlando Caum

  • Support Staff

July 1, 2015 at 1:33 pm

Hello, I’m not sure that it will work as expected even if you have that information added. In its current state, its going to insert that information site-wide which include Event Espresso pages, WP pages, and blog posts.

A more flexible option would be to setup a plugin like WordPress SEO.

Then adjust SEO –> Titles and Metas –> Post Types –> Events to show the excerpt and save changes.

The next part will be to enter some information in the event excerpt area of the event editor and save changes. This will allow you to add a custom message while not affecting other non-event pages on your site.


Lorenzo


Su Yuen Chin

July 1, 2015 at 11:32 pm

Hi Lorenzo,

Thanks for the suggestion. I have problems with that.

1. It does not have property=”og:description” attribute in the meta tag.
2. What should I write to get excerpt< in meta tag?
3. I can modify my function using an if block to apply the code only to events pages. But how do I get the date and time?


Su Yuen Chin

July 2, 2015 at 1:05 am

My mistake. I did not see the attribute property=”og:description” added by WordPress SEO. Can you tell me how to get excerpt to display.


Su Yuen Chin

July 2, 2015 at 1:10 am

git it 🙂 %%excerpt%%


Dean

July 2, 2015 at 4:56 am

Glad you got it worked out! Is this matter resolved now?


Su Yuen Chin

July 2, 2015 at 9:10 am

Yes Dean. It is resolved.

The support post ‘Get event date and time’ 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