-
AuthorPosts
-
January 16, 2024 at 6:21 pm #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,
SophiaJanuary 17, 2024 at 9:37 am #1430779Hey 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,
IsmaelJanuary 23, 2024 at 12:39 am #1431725Great – this shortcode solution did the trick.
Thanks so much!
January 23, 2024 at 5:31 am #1431739 -
AuthorPosts
- The topic ‘Trouble with ifRame’ is closed to new replies.