Tagged: ,

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1430749

    Hello –

    I’ve embedded an iframe onto my site using the advanced layout editor (Avia Layout Builder), but I am getting the spinning wheel of death and can no longer edit the page. When the iframe is added in with the default editor I have no problem seeing it in the editor, but then I can’t add in other elements like titles and buttons.

    How can I stop the loading so I can edit the page? For some reason whenever I inject code onto a page, it has this loading issue.

    Thanks,
    Sophia

    #1430779

    Hey sophiasbiti,

    Thank you for the inquiry.

    If the iframe is causing errors in the builder, you might want to consider creating a custom shortcode for it. Instead of embedding the iframe directly into the builder, you can use the custom shortcode. This shortcode will then render the iframe on the frontend.

    Example:

    // Define a custom shortcode for iframe
    function custom_iframe_shortcode($atts) {
        // Set default attributes
        $atts = shortcode_atts(
            array(
                'src' => '',
                'width' => '100%',
                'height' => '300',
            ),
            $atts,
            'custom_iframe'
        );
    
        // Extract attributes
        $src = esc_url($atts['src']);
        $width = esc_attr($atts['width']);
        $height = esc_attr($atts['height']);
    
        // Output the iframe code
        $output = '<iframe src="' . $src . '" width="' . $width . '" height="' . $height . '" frameborder="0" allowfullscreen></iframe>';
    
        return $output;
    }
    
    // Register the shortcode
    add_shortcode('custom_iframe', 'custom_iframe_shortcode');
    

    You can use it in in the ALB like this:

    [custom_iframe src="https://example.com" width="100%" height="400"]
    

    Please check the link below for more info.

    // https://codex.wordpress.org/Shortcode_API

    Best regards,
    Ismael

    #1431725

    Great – this shortcode solution did the trick.

    Thanks so much!

    #1431739

    Hi,

    Glad to know this solution worked. Please let us know if you have more questions about the theme.

    Have a nice day.

    Best regards,
    Ismael

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Trouble with ifRame’ is closed to new replies.