I have this code and the $var1 arrives empty to my function i dont know why, i've tested declaring the variable inside the function and it does work but when i try to declare it outside the function and pass it as a parameter with the do_action it doesn't work, any insights on this ? thanks
The add_shortcode works fine
$name="link";
add_shortcode($name, 'aa_link_shortcode' );
function shorcode_resources($var1) {
global $post;
$shortcode_found = false;
if ( has_shortcode($post->post_content, $var1) ) {
$shortcode_found = true;
}
if ( $shortcode_found ) {
wp_enqueue_style( 'core', ABS_URL . '/shortcode/css/flipbox.css' , false );
wp_enqueue_script( 'my-js',ABS_URL . '/shortcode/js/flipbox('.$var1.').js', false );
}
}
do_action( 'wp_enqueue_scripts', $name);
add_action( 'wp_enqueue_scripts', 'shorcode_resources', 10, 1 );