modern-events-calendar-lite/app/addons/divi/includes/MECShortcodesForDivi.php

20 lines
682 B
PHP
Raw Normal View History

2024-10-15 12:04:03 +02:00
<?php
if(! function_exists( 'MECDIVI_et_builder_load_actions' )) {
function MECDIVI_et_builder_load_actions( $actions ) {
$actions[] = 'MECDIVI_load_mec_shortcode';
return $actions;
}
}
add_filter( 'et_builder_load_actions', 'MECDIVI_et_builder_load_actions' );
if(! function_exists( 'MECDIVI_load_mec_shortcode' )) {
function MECDIVI_load_mec_shortcode() {
if(!current_user_can('manage_options')) return;
$post_id = sanitize_text_field($_POST['shortcode_id']);
echo do_shortcode( '[MEC id="'.$post_id.'"]' );
wp_die();
}
}
add_action( 'wp_ajax_MECDIVI_load_mec_shortcode', 'MECDIVI_load_mec_shortcode' );