Created
July 12, 2020 20:12
-
-
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'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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