This file contains hidden or 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 | |
| /** | |
| * Register custom Elementor display conditions. | |
| * | |
| * @param \Elementor\Core\Kits\Documents\Tabs\Conditions_Manager $conditions_manager | |
| * @return void | |
| */ | |
| function register_custom_elementor_conditions( $conditions_manager ) { |
This file contains hidden or 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
| /* --------------------------------------------------------------------------- | |
| * Force Elementor Library to use Canvas Template | |
| * - this gist file name can also be used in your theme to override the template instead of this | |
| * --------------------------------------------------------------------------- */ | |
| function get_elementor_library_post_type_template( $single_template ) { | |
| global $post; | |
| if ($post->post_type == 'elementor_library') { | |
| $single_template = WP_PLUGIN_DIR . '/elementor/includes/page-templates/canvas.php'; | |
| } |
This file contains hidden or 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
| //How to hide any widget with an id of 'test': | |
| add_filter( 'elementor/frontend/widget/should_render', function( $bool, $element ){ | |
| $settings = $element->get_settings(); | |
| if( 'test' === $settings['_element_id'] && 'heading' === $type ){ | |
| return false; | |
| } else { return true } | |
| }, 10, 3); | |
| //How to hide any specific type of widget': | |
| add_filter( 'elementor/frontend/widget/should_render', function( $bool, $element ){ |
This file contains hidden or 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>'; | |
| } | |
| } |
This file contains hidden or 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
| var nav = false; | |
| const menu_close = () => { | |
| //elementorProFrontend.modules.popup.closePopup( { id: 191 } ); | |
| elementorFrontend.documentsManager.documents[191].getModal().hide(); | |
| nav = false; | |
| //console.log('menu closed!'); | |
| } | |
| const menu_open = () => { | |
| //elementorProFrontend.modules.popup.showPopup( { id: 191 } ); |
This file contains hidden or 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
| // check_webp_feature: | |
| // 'feature' can be one of 'lossy', 'lossless', 'alpha' or 'animation'. | |
| // 'callback(feature, isSupported)' will be passed back the detection result (in an asynchronous way!) | |
| // see: https://stackoverflow.com/a/54631141/4845112 | |
| function check_webp_feature(feature, callback) { | |
| var kTestImages = { | |
| lossy: "UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA", | |
| lossless: "UklGRhoAAABXRUJQVlA4TA0AAAAvAAAAEAcQERGIiP4HAA==", | |
| alpha: "UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAARBxAR/Q9ERP8DAABWUDggGAAAABQBAJ0BKgEAAQAAAP4AAA3AAP7mtQAAAA==", | |
| animation: "UklGRlIAAABXRUJQVlA4WAoAAAASAAAAAAAAAAAAQU5JTQYAAAD/////AABBTk1GJgAAAAAAAAAAAAAAAAAAAGQAAABWUDhMDQAAAC8AAAAQBxAREYiI/gcA" |
This file contains hidden or 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 | |
| function set_elementor_global_colors_once() { | |
| if ( ! get_option('my_theme_elementor_colors_set') ) { | |
| $global_settings = \Elementor\Plugin::$instance->kits_manager->get_active_kit(); | |
| $global_settings->set_settings([ | |
| 'system_colors' => [ | |
| 'primary-color' => [ | |
| 'title' => __('Primary Color', 'your-textdomain'), | |
| 'color' => '#1e73be', |
This file contains hidden or 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 | |
| function add_lazy_render_to_elementor_sections($element, $section_id, $args) | |
| { | |
| if (in_array($element->get_name(), ['section', 'container'])) { | |
| if (!$element->get_controls('hiroman_lazy_render')) { | |
| $element->start_controls_section('flying_press', [ | |
| 'tab' => \Elementor\Controls_Manager::TAB_ADVANCED, | |
| 'label' => esc_html__('Lazy Render HTML', 'hiroman'), | |
| ]); |
This file contains hidden or 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 | |
| // place the snippet inside the functions.php file from your WordPress child theme | |
| use Elementor\Controls_Manager; | |
| add_action( 'elementor/dynamic_tags/register_tags', function( $dynamic_tags ) { | |
| class Custom_Image_Tag extends Elementor\Core\DynamicTags\Data_Tag { | |
| public function get_name() { | |
| return 'shortcode-image'; | |
| } |