Tagged: html
Hi there –
Whenever I add an HTML code block and update the page, I get the spinning wheel circle and am no longer able to edit the HTML of the page. Is there a solution for this? I need to be able to edit the page…
Currently testing on staging site, but will replicate on live site once we have a solution.
Thanks,
Sophia
Hey sophiasbiti,
Thank you for the inquiry.
Are you inserting scripts or input tags within the Code Block element? Please note that such tags could break the builder’s functionality and are not recommended. You might have to create a custom shortcode for handling these script and input tags, instead of adding them directly to the builder.
// https://codex.wordpress.org/Shortcode_API
Best regards,
Ismael
Thanks, Ismael. I will try creating a shortcode for it. Are there any recommended plugins that could do this for me? I’m thinking of using https://wordpress.org/plugins/shortcoder/
Thank you!
Hi,
Thank you for the update.
Yes, you can use the plugin but you can also do it manually in the functions.php file.
Example:
function av_custom_input_script_shortcode($atts) {
$atts = shortcode_atts(
array(
'type' => 'text',
'placeholder' => '',
'script' => '',
),
$atts
);
$type = esc_attr($atts['type']);
$placeholder = esc_attr($atts['placeholder']);
$script = esc_js($atts['script']);
$output = '<input type="' . $type . '" placeholder="' . $placeholder . '" />';
$output .= '<script>' . $script . '</script>';
return $output;
}
add_shortcode('av_custom_input_script', 'av_custom_input_script_shortcode');
In the builder, you can use this shortcode:
[av_custom_input_script type="text" placeholder="Enter your text" script="alert('Input submitted');"]
Best regards,
Ismael