Embedding Eventbrite in CPTs or enabling the Gutenberg Editor

This topic contains 4 replies, has 2 voices, and was last updated by  Alex Rollin 4 years, 8 months ago.

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

Open Support Ticket
  • Author
    Posts
  • #531033

    Romeo Crow
    Expired Member
    Post count: 54

    I want to embed an Eventbrite event in a CPT.

    I can’t seem to do it because either:

    1) the code from the widget (see private post below) doesn’t display, or
    2) I can’t edit the CPT using Gutenberg.

    I know that I “just” need to enable show_in_rest for the CPT to show Gutenberg but I don’t know how/where to do that.

    I did find the following code on developers.wordpress but I’m not sure how or where to implement or if it will work:

    /**
    * Add REST API support to an already registered post type.
    */
    add_filter( ‘register_post_type_args’, ‘my_post_type_args’, 10, 2 );

    function my_post_type_args( $args, $post_type ) {

    if ( ‘book’ === $post_type ) {
    $args[‘show_in_rest’] = true;

    // Optionally customize the rest_base or rest_controller_class
    $args[‘rest_base’] = ‘books’;
    $args[‘rest_controller_class’] = ‘WP_REST_Posts_Controller’;
    }

    return $args;
    }

    How can I sort this out?

    #531034

    Romeo Crow
    Expired Member
    Post count: 54
    This reply has been marked as private.
    #531104

    Alex Rollin
    Moderator
    Post count: 27815

    To execute advanced scripts like iFrames in GeoDirectory custom fields you will want to disable the built in sanitization for the field.

    To do this we recommend you create an HTML type GD Custom Field, and make it Admin only so that your listing owners cannot use scripts in the field to damage your site.

    Then view these links to find an example snippet. Modify the snippet and add it to your site.

    https://wpgeodirectory.com/docs-v2/places/custom/#advanced
    https://wpgeodirectory.com/docs-v2/places/custom/#scripts
    https://wpgeodirectory.com/docs-v2/faq/customizing/

    We do not recommend or support the use of Gutenberg or other page builders in the post_content field or other textarea or HTML or other GeoDirectory Custom fields in a GeoDirectory Custom Post Type.

    Of note, you may also want to check out the new GD Dynamic Content Element. It can be used to substitute listing custom field values into 3rd party shortcodes. I do not think that will support advanced scripts either, just shortcodes, but, give it a try and if you want to write back with your experience, please do.

    Let us know how it goes

    #531228

    Romeo Crow
    Expired Member
    Post count: 54
    This reply has been marked as private.
    #531267

    Alex Rollin
    Moderator
    Post count: 27815

    Yes, you will need to add the snippet here, set for your eventbrite field, to stop stripping/sanitization.

    https://wpgeodirectory.com/docs-v2/places/custom/#scripts

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

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

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount