You are doing the do_action
before the action is add, try moving it:
$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);
}
}
//first we add the action
add_action('wp_enqueue_scripts', 'shorcode_resources', 10, 1);
//then we do the action
do_action('wp_enqueue_scripts', $name);
also remember that wp_enqueue_scripts
its an action that WP will trigger too
Related Posts:
- jQuery does not work
- Scripts not loading when using the wp_enqueue_scripts action
- How to use wp_enqueue_script properly?
- True parameter but jquery register in header and not in the footer with wp_register_script
- How to load scripts/styles specific for a page
- How to use the do_action () with parameter
- Perform an action when post is updated/published
- Extract image from content and set it as the featured image
- Do WordPress’ cron’s clean up expired transients?
- deregister scripts on certain page
- Refresh page after form action
- How to restrict actions and filters “properly” by conditions
- How to count number of functions attached to an action hook?
- How to enqueue every script in a folder automatically?
- Using get_terms for custom taxonomy in functions.php
- Fatal error: Call to undefined function add_action() – an untouched problem
- wp_register_script not loading as expected
- Dequeue Scripts and Style for Mobile not working?
- Call to undefined add_action() in theme’s functions.php
- How to enqueue JavaScript for specific WordPress pages only?
- Enqueue script o style only if a template part is loaded
- Automatically Add Specified Value to Attachment Metadata upon Upload
- Can’t Update function.php after writing short code
- How to update feed only 2-3 times a week (for Feedburner email)?
- wp_enqueue_script add integrity parameter
- When using wp_enqueue_script(); in a theme why don’t we use add_action?
- How to select a page within admin?
- How to manage arrays from custom functions stored in functions.php?
- wp_is_mobile dequeue not working
- Register vendor JS/CSS only on pages that require them?
- Why won’t my scripts load?
- Only let plugin add actions to wp_head & wp_footer on single posts
- Register and load scripts
- Which action does wp_update_user triggers?
- How can I get my Script to work on the Login page?
- Trigger a custom function when option are saved in admin area
- how to en-queue jQuery to load before the tag
- Redirect to another page if the user is logged in when pressing again the login button on menu bar
- Attempt to change jQuery version caused White Screen of Death
- Difference b/w Simple function call & do_action call
- Override the WordPress core function wp_referer_field
- Set Taxonomy based on post status
- add_action template_redirect not working for home page
- AMP – Change rel=”canonical” from functions.php [closed]
- add_action wp_enqueue_script priority level only works for admins
- Is there a way to prevent a function/method from being called outside a specific hook?
- Why does get_template_directory_uri() not include “www”, only for enqueued stylesheets?
- Missing argument for the function
- Enqueue script on every page except one
- current_user_can comma list vs OR (||) list
- Adding code before post title with the_title produces weird results
- Add back in child theme what the parent theme removed with remove_action
- Load JS file only in specific template
- login_headertitle is deprecated since version 5.2.0
- Init action and refresh page after form action
- 400 Bad Request – JavaScript App calling Custom wp-json endpoint
- 404 when enqueue_script using plugin_url
- Changing where my author box is printed
- video.js not enqueueing?
- Problem with custom function when I go back with the browser
- How do I find the code executed when wp_head() is called?
- Why is this function crashing my wordpress installation? [closed]
- colorbox not loading in
- Fatal error: allowed memory size when after using enqueue_script
- wp_enqueue_script() not working
- Get webpack to work on child theme
- How to load a css file depending on the current role
- localize_script but data changes dependent on product ID
- Add custom css file after plugin css with WordPress Child Theme functions.php
- How to Override Page Template if URL matches query?
- Save_post – Warning: Cannot modify header information
- If has action not working as expected
- Modifying a WordPress Plugin
- wp enqueue style on about us page
- Is_Page doesnt detect my page
- How do you insert code into the sidebar?
- Test CDN link from function.php or wp_enqueue_script/style?
- How to show only specific category post by user role without plugin and restrict all other cats
- Postback redirect through add_action is not triggered
- Unable to declare AOS library in functions
- Remove action hook from Class, understanding OOP
- How to change form action of wp-login page with a function
- WP Enqueue Script Error
- Which method is more correct for removing WooCommerce Extensions menu item?
- WordPress hooks to call a function inside a construct
- WordPress Jquery+scripts enqueue issue
- Pass arguments to function class with do_action()
- custom COOKIE on custom page
- What add_action reference should I be using or should I use do_action?
- Getting error while trying to use custom comment function
- Settings in functions.php used by a plugin
- Exclude javascript in certain page url and all following url’s after forward slash
- Using array page name together with page id to deregister script
- Remove snippets of JS from core
- Why my wp_enqueue_script doesnt work on some page?
- WordPress – Notice: Function wp_enqueue_script was called incorrectly
- dynamically import array from another js file in WordPress
- delete_term is not working properly with add_action()
- Loading newest dependency javascript module file in functions.php
- How to get variable from other function inside class function using add_action for Ajax call