Embedding Code into Listings

This topic contains 10 replies, has 4 voices, and was last updated by  Dave 4 years, 2 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket

Tagged: 

  • Author
    Posts
  • #539559

    Dave
    Full Member
    Post count: 205

    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-info

    Am I setting it up incorrectly?

    I’ve tried both enabling and disabling ‘Embed media URLs’.

    Appreciate your help.

    Thanks,
    Dave

    #539563

    Guust
    Moderator
    Post count: 29970

    Allow 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

    #539595

    Alex Rollin
    Moderator
    Post count: 27815
    #539777

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Hi 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

    #539828

    Dave
    Full Member
    Post count: 205

    Thanks 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,
    Dave

    #539829

    Alex Rollin
    Moderator
    Post count: 27815

    The user id in a custom field, then insert the custom field into the script (inside a GD Dynamic content element).

    #539837

    Dave
    Full Member
    Post count: 205

    Thanks 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,
    Dave

    #539860

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Hi dave, it looks like all the quotes, both single and double are the wrong type, i think fixing that should make it work.

    Stiofan

    #539991

    Dave
    Full Member
    Post count: 205

    Hi Stiofan,

    Sorry, do you mean I just need to swap all the ” inside the script to ‘ ?

    Thanks,
    Dave

    #539997

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Pretty 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

    #540041

    Dave
    Full Member
    Post count: 205

    Brilliant, that’s worked! thanks!

    I had no idea there was a difference in curly ones and straight ones lol.

    Thanks again,
    Dave

Viewing 11 posts - 1 through 11 (of 11 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket