Embedding Code into Listings
This topic contains 10 replies, has 4 voices, and was last updated by Dave 4 years, 7 months ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support TicketTagged: HTML Code
-
AuthorPosts
-
April 10, 2020 at 10:54 pm #539559
Hi guys,
I’m trying to provide a way for my users to embed a piece of code into their listings i.e. Eventbrite ticket checkout widget
It looks something like this…
<div id=”eventbrite-widget-container-102448781062″></div>
<script src=”https://www.eventbrite.co.uk/static/widgets/eb_widgets.js”></script>
<script type=”text/javascript”>
var exampleCallback = function() {
console.log(‘Order complete!’);
};window.EBWidgets.createWidget({
// Required
widgetType: ‘checkout’,
eventId: ‘102448781062’,
iframeContainerId: ‘eventbrite-widget-container-102448781062’,// Optional
iframeContainerHeight: 425, // Widget height in pixels. Defaults to a minimum of 425px if not provided
onOrderComplete: exampleCallback // Method called when an order has successfully completed
});
</script>I thought it would be a case of just adding in a HTML code custom field, but it isn’t working and only showing the code on the listing. Example here…
https://whatsonhub.co.uk/events/united-kingdom/northern-lincolnshire/rolling-stones-story/#booking-infoAm I setting it up incorrectly?
I’ve tried both enabling and disabling ‘Embed media URLs’.
Appreciate your help.
Thanks,
DaveApril 11, 2020 at 12:18 am #539563Allow users to embed code like that is a security risk for your website, and WordPress prevents it.
There may be some other options: https://wordpress.org/plugins/search/eventbrite/Thanks
April 11, 2020 at 8:07 am #539595https://wpgeodirectory.com/docs-v2/places/custom/#scripts (customization)
April 13, 2020 at 8:29 am #539777Hi Dave,
Please see the examples here for a safe way to do things https://geodirectory.helpscoutdocs.com/article/53-gd-dynamic-content
If anything is unclear please ask.
Thanks,
Stiofan
April 13, 2020 at 3:02 pm #539828Thanks for the help guys.
So from what I’ve seen from the links you sent, it looks like using the Dynamic Content shortcode/widget would be the best option.
To do this, would I be best following the first (basic) example and set up a custom field for users to insert their eventbrite ID?
And then just insert the code into the text field and insert the custom field using %% tags?
Thanks,
DaveApril 13, 2020 at 3:06 pm #539829The user id in a custom field, then insert the custom field into the script (inside a GD Dynamic content element).
April 13, 2020 at 3:38 pm #539837Thanks Alex.
I’ve just setup a custom field with field key as ‘eventbrite_checkout_id”.
I’ve set up the following shortcode and inserted it into the event details page using the tabs:
[gd_dynamic_content key=”eventbrite_checkout_id” condition=”is_not_empty”]<div id=”eventbrite-widget-container″></div>
<script src=”https://www.eventbrite.co.uk/static/widgets/eb_widgets.js”></script>
<script type=”text/javascript”>
var exampleCallback = function() {
console.log(‘Order complete!’);
};window.EBWidgets.createWidget({
// Required
widgetType: ‘checkout’,
eventId: ‘%%eventbrite_checkout_id%%’,
iframeContainerId: ‘eventbrite-widget-container’,// Optional
iframeContainerHeight: 425, // Widget height in pixels. Defaults to a minimum of 425px if not provided
onOrderComplete: exampleCallback // Method called when an order has successfully completed
});
</script>
[/gd_dynamic_content]As you can see, I’ve set the field key to the correct custom field ID, and inserted the custom field %% tag into the code in the middle.
I’ve inserted my eventbrite event ID into the following listing, but it’s not picking up the checkout for some reason.
https://whatsonhub.co.uk/events/united-kingdom/northern-lincolnshire/rolling-stones-story/
Any ideas?
Thanks,
DaveApril 13, 2020 at 5:28 pm #539860Hi dave, it looks like all the quotes, both single and double are the wrong type, i think fixing that should make it work.
Stiofan
April 14, 2020 at 7:17 am #539991Hi Stiofan,
Sorry, do you mean I just need to swap all the ” inside the script to ‘ ?
Thanks,
DaveApril 14, 2020 at 7:38 am #539997Pretty much, but replace doubles with doubles and singles with singles. they should not be curly like ” they should be straight
"
If you have no luck you can provide login details and I’ll have a look.
Stiofan
April 14, 2020 at 11:12 am #540041Brilliant, that’s worked! thanks!
I had no idea there was a difference in curly ones and straight ones lol.
Thanks again,
Dave -
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket