Skip to content

Instantly share code, notes, and snippets.

@pingram3541
Created July 12, 2020 20:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pingram3541/842b6af947b5ebf81973afcda1ab344b to your computer and use it in GitHub Desktop.
Save pingram3541/842b6af947b5ebf81973afcda1ab344b to your computer and use it in GitHub Desktop.
Add disclaimer notice after all Elementor HTML widgets that use id 'html_notice'
<?php
add_action( 'elementor/widget/render_content', function( $content, $widget ) {
if ( 'html' === $widget->get_name() ) {
$settings = $widget->get_settings(); //contains all widget settings - read-only!
//checks if special id exists
if ( ! empty( $settings['_element_id'] ) && $settings['_element_id'] === 'html_notice' ) {
$content .= '<div class="disclaimer_notice"><span>Copy and use of the above code is at your own risk.</span></div>';
}
}
return $content;
}, 10, 2 );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment