Support

Home Forums Event Espresso Premium Venue Manager and Custom Fields for Posts

Venue Manager and Custom Fields for Posts

Posted: August 28, 2012 at 12:28 pm


Mark Basla

August 28, 2012 at 12:28 pm

Hi. Attempting to integrate EE into our WordPress and have failed using custom templates. We may have a plugin conflict, I’m not sure.

To get around this, we are using the Event Posts to share our event information. So far, it’s been fine. But there is one problem.

The Venue Manager does not post it’s values to the Custom Fields when you export an event as a Post. If you disable the Venue Manager, and manually type in the address in the Venue fields, it works.

As an organization with multiple locations, the Venue Manager is a reason we were excited about EE. Can this be addresses somehow? Is there a patch, or something I might be missing? Any help on this topic would be appreciated.


Mark Basla

August 28, 2012 at 12:47 pm

It also looks like that the Event Post Custom Field for the Price of the event is missing as well. This would be essential to for us. Am I missing it, or can it be added easily?


Chris Reynolds

  • Support Staff

August 28, 2012 at 1:14 pm

Have you tried using the venue shortcodes for venue information?


Chris Reynolds

  • Support Staff

August 28, 2012 at 1:15 pm

Ditto the above for price shortcodes. You can embed these into the page template by wrapping the shortcode in a do_shortcode function.

https://eventespresso.com/wiki/shortcodes-template-variables/


Mark Basla

August 28, 2012 at 1:34 pm

Chris, thank you!

I have attempted the short codes in a non-EE templates with no luck. Fully php and do_shortcode wrapped versions and they have not worked. And my apologies, that is a point of clarification. We are attempting to pull in all the venue and pricing data into a standard wordpress template. In theory the shortcodes should still work, but haven’t.

Since we are talking about the Event Posts, and not the event list/registration templates, do I need to specify the event_id somewhere in the Posts template to facilitate the shortcode?

Thanks! All help is appreciated greatly!


Chris Reynolds

  • Support Staff

August 28, 2012 at 3:23 pm

Yes, either shortcode will support the event_id parameter and that would be required if you are using them on a page that is not the event itself. So:

<?php $event_id = get_post_meta($post->ID, 'event_id', true); ?>
<?php echo do_shortcode('[ESPRESSO_VENUE event_id="'.$event_id.'"]'); ?>
...
<?php echo do_shortcode('[EVENT_PRICE event_id="'.$event_id.'" number="0"]'); ?>

The first line (where $event_id is defined) is required to pull the event ID from the post meta so you can feed that into the shortcode. If you weren’t editing the template, you could do the same thing and manually add the event ID to the shortcode.


Mark Basla

August 28, 2012 at 3:26 pm

Chris, this looks like what I needed! I will give this a try and post the results. Thank you!


Mark Basla

August 29, 2012 at 8:39 am

Chris, thanks! This works perfectly and has saved me tons of hassle. Thank you for your help and thank you for the code!


Mark Basla

August 29, 2012 at 8:51 am

One last thing. I have attempted using the same code for the EE_META, with no luck. I’ve added the event_id attribute to the EE_META shortcode, but that didn’t work. Here’s the code:

ID, 'event_id', true); 
$event_cost = do_shortcode('[EVENT_PRICE event_id="'.$event_id.'" number="0"]');
if ($event_cost == "0.00" || $event_cost == NULL) {
echo "No Cost";
} else {
echo $event_cost; 
}
echo do_shortcode('[EE_META event_id="'.$event_id.'" type="event_meta" name="event_cventlink"]'); ?&gt;

Any ideas on how to get this working? The price portion works perfectly, but the EE_META is not displaying. Any help you could provide would be amazing! Thanks!


Chris Reynolds

  • Support Staff

August 29, 2012 at 11:17 am

I’m assuming that the event_cventlink (sic?) meta key exists in your event? And it has a value? And that’s not a typo?


Mark Basla

August 29, 2012 at 11:25 am

Yes, that’s correct. It’s in there.


Chris Reynolds

  • Support Staff

August 29, 2012 at 12:12 pm

What happens if you just use the EE_META shortcode in the post content?

also: is this actually part of your code or is this cut off?

ID, 'event_id', true); 


Mark Basla

August 29, 2012 at 12:29 pm

Chris, I’ve been working on the posts template all day, so the code changed a little. I switched it up and am using the event_externalURL to get the $event_cventlink now. But, the same problem exists. I am attempting to pull in a note about pricing that’s a EE_META value.

Using either of the options below yields no results.

do_shortcode('[EE_META event_id="'.$event_id.'" type="event_meta" name="event_pricenote"]');
do_shortcode('[EE_META type="event_meta" name="event_pricenote"]');

Here’s my current code.

ID, 'event_id', true); 
$event_pricenote = do_shortcode('[EE_META event_id="'.$event_id.'" type="event_meta" name="event_pricenote"]');
$event_cost = do_shortcode('[EVENT_PRICE event_id="'.$event_id.'" number="0"]');

if ($event_pricenote == "" || $event_pricenote == NULL) {
if ($event_cost == "0.00" || $event_cost == NULL) {
echo "No Cost";
} else {
echo $event_cost; 
}
} else {
echo $event_pricenote;
} ?&gt;

Another way to solve this problem would be a short code in same family as EVENT_PRICE that would display the event price name. It there was a shortcode that displayed the EVENT_PRICE_NAME, that is exactly what I’m looking for. Right now, the only place to see the EVENT_PRICE_NAME is in the Event Price Dropdown in on the Registration page. We want to list those values.

You’re help so far has been fantastic. Thank you.


Mark Basla

August 29, 2012 at 12:31 pm

Here’s the line that keeps getting cut off for some reason.

$event_id = get_post_meta($post-&gt;ID, 'event_id', true); 


Chris Reynolds

  • Support Staff

August 29, 2012 at 2:23 pm

That’s just weird because I know what you are doing is possible — I’m doing the same thing in this tutorial: https://eventespresso.com/wiki/selectively-hide-the-add-to-cart-link/#method-2

A different shortcode for EVENT_PRICE_NAME (or alternately trying to grab those values from the database) is probably opening up a can of worms that you don’t want to get into. At this point, doing so with what you have and pulling it from the db is slightly more reasonable (since you’re already getting the event_id) but there isn’t an existing shortcode that displays the price name.

I will say, though, that this line isn’t really necessary:

if ($event_pricenote == "" || $event_pricenote == NULL)

You can get the same result by just doing this:

if ( $event_pricenote )

If $event_pricenote is empty, it will return false, so you don’t need to worry about the OR or if it has a null or empty value. I don’t think that’s your issue, though.


Mark Basla

August 29, 2012 at 2:31 pm

Chris, thanks! I’ll look through the tutorial, more deeply. On quick glance though, it looks like it’s for the EE templates, which I’m not using. I’m using the WordPress templates, and using the short codes to bring in the EE data.

Still, it’s odd that the custom fields would work, but the EE META fields would not. We should be able to move forward without this information. For right now, what I was putting this in place for is a rare bit of event information, that won’t be used on most events. So, we will skip it and move on.

Thank you so much for your help. At minimum, I hope our thread here shows some areas of growth for EE when it comes to WordPress template integration. Thanks!


Chris Reynolds

  • Support Staff

August 29, 2012 at 5:46 pm

That’s true, but you’re still using the shortcode which sort of supersedes what type of template you’re using and work regardless. (That’s kind of the whole point of shortcodes. And all the do_shortcode function does is let you put a shortcode into a php file and execute it as if it was in the_content — it doesn’t matter if that php file is a theme template file or anything else as long as WordPress is running.) One test you can try is just throwing the EE_META shortcode with a hard-coded event_id in an event and do the same in a post/page. It should work in either, if it’s not, something’s not working right.


Chris Reynolds

  • Support Staff

August 29, 2012 at 5:50 pm

Oh! Also — another idea if you’re using the CPTs is adding a new custom field in the event post and then pulling that with get_post_meta. It wouldn’t be pulling it from the event, so it would be less automatic, though. The reason ee_meta doesn’t necessarily get passed over to the post type is that they aren’t exactly the same thing; we’re basically using ee_meta as if it were post meta, but since we’re not using the actual WordPress loop/post system for events, it’s a different thing. In the future, we’re planning on moving towards using post types for things, at which point this will be a non-issue. Hopefully before then we can sort of dump the ee_meta into custom post meta in event posts — the ee_meta functionality is still pretty new.

The support post ‘Venue Manager and Custom Fields for Posts’ 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