<?php
if ( function_exists('elementor_load_plugin_textdomain')) {
 
    function TkNaF_init_elementor() {
        add_shortcode( 'tarot', 'TkNaF_shortcode_elementor');
    }
    add_action( 'elementor/preview/init', 'TkNaF_init_elementor' );


    function TkNaF_shortAdmin_elementor($output, $tag, $attr, $m){ 
        $getElementor = (isset($_GET['action'])) ? sanitize_text_field($_GET['action']) : null;	
        if( $tag == 'tarot' && $getElementor == 'elementor' ) {
            $nameTarot = strtr($attr['name'], '_', ' ');
            $output = '<div style="position: relative;border: 1px solid;height: 350px;text-align: center;padding-top: 38px;">
            <h4 style="margin: 0;font-weight: 400;">'.ucfirst($nameTarot).'​</h4>
            <div style="margin-top: 8px;font-size: 13px;margin-bottom: 20px;">*&nbsp;'.__('Click on preview changes to see the tarot.', 'tarokina-free').'</div>
            <div style="display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-pack: center;-ms-flex-pack: center;justify-content: center;"><img style="display: block;" src="'. plugin_dir_url( __DIR__ ).'img/tarokina-free-img-elementor.png" alt="tarokina elementor"></div>
            </div>';
        };
        return $output;
    } 
        add_filter('do_shortcode_tag', 'TkNaF_shortAdmin_elementor', 1, 4);    

}