function load_grid() {
if ( current_user_can( 'level_10' ) ) {
wp_enqueue_style('grid_css', plugins_url('/lib/css/grid.css', __FILE__) );
wp_enqueue_script('grid_js', plugins_url('/lib/js/grid.js', __FILE__), array('jquery') );
}
}
add_action('wp_enqueue_scripts', 'load_grid');
Related Posts:
- wordpress plugin add page when activate
- Frontend Enqueued Files in the Backend
- Conditionally enqueue a widget’s script/stylesheet in HEAD (only when present on page!)
- Loading external page template and enqueue script from plugin causes 403 forbidden error
- How do I force wp_enqueue_scripts to load at the END of ?
- When can you get current page ID and initialize hooks right after?
- enqueue script only if it is not already enqueue
- How can I dequeue a Plugin Stylesheet?
- Which method is best to enqueue scripts
- WordPress Capabilities: edit_user vs edit_users
- How to load different css file for different pages
- Allowing Custom Capability to Manage Plugin Options
- Get info (url) from already enqueued styles
- Declaring script dependencies between scripts enqueued with different action hooks
- Pass $this to function nested in another public function of the same class
- Dequeue / Deregister script and replace it with a new plugin
- Custom data-id wp_enqueue_script
- wp_enqueue_scripts not working inside shortcode
- wp_enqueue_script fails to include in footer
- Avoiding Duplicate function names in Post Loop (WP_Footer script)
- Is it possible to enqueue CSS files from plugin before theme’s CSS files?
- How to remove style and js from theme and add your own style and js where shortcode is used?
- React JSX in WordPress Plugin Development
- Enqueue WordPress plugin scripts below all other JS
- jQuery for custom plugin not working with Divi theme
- Adding Font Awesome to WP Plugin
- Unable to delete custom post types, confusion around capabilities
- How can I remove the WordPress-Version (?ver=5.x) from my plugin
- Create shortcode to echo javascript
- Why am I unable to load scripts in head in plugin?
- wp_enqueue_style on template_redirect level?
- Custom plugin – load enqueue only for this plugin
- plugin enqueue style on all pages
- is it possible to hook every page style?
- Deregister scripts from plugin
- Custom CSS not being added by plugin
- why the wp_register_script doesn’t work for register_activation_hook
- How To Create A File Archive in WordPress?
- Edit all $wp_scripts at once to $in_footer = false
- Edit all $wp_scripts at once to $in_footer = false
- Why won’t wp_enqueue_script work within any plugin file?
- How to add styles to a submenu page?
- Why can I not deregister my style and script on custom post type?
- WordPress include scripts and style in plugin page
- plugin’s script and style enqueing not working on Thesis
- wp_enqueue_script doesn’t load JS in plugin
- All Users > User List > Update User Meta Field Inline
- Checking instances of scripts in wp_head
- How to save post change url youtube link?
- Best approach to fetch data from wp options to js file or php file
- Correct way to perform non-cacheable DB query
- Allow users of my plugin to define their own shortcode rather than use mine?
- Is it possible to create Custom Post plug-in?
- uninstall.php file in Plugin to clean DB
- Archive – same title for the first two posts
- Creating a plugin to sanitize comment and the url field before display only
- Edit Yoast SEO breadcrumbs output [closed]
- Creating plugin using simple_html_dom parser?
- Object Oriented Plugin not working
- issues with wp_enqueue_script in my plugin
- Does WP identify plugin by plugin name or plugin_basename?
- switched from query_posts to WP_query, not working now?
- Create entire wordpress as a github repositery?
- Help With MySQL to WPDB Query Conversion
- When to load auto-login code?
- AJAX search posts and pages
- How to find the origin of a file upload from within wp_handle_upload?
- How would I go about creating a user ranked post popularity page?
- CSV file generation failing
- Updating the Drag-To-Share eXtended share URLs?
- finding whether request is for post, and post id
- Building plugin with changeable custom post type values…advice needed
- How to get all of the activate_plugin action parameters?
- __callStatic method handler passed to add_action causes bug in PHP
- Display update notification messages like ‘What’s New’
- How to add Internationalization in WordPress using Javascript/React?
- CRUD and Frontend show from a custom table without shortcode
- How to get specific setting by settings_fields()?
- Save / Show multi line text in metabox
- Creating mySQL procedure with $wpdb
- how to disable blockrenderAppender inside all Innerblocks?
- why doesn’t this update part of this plugin work? it take me to nothing here page
- Redirection of users away from wp-admin (but not administrators)
- WordPress Gutenberg react make import of __experimentalUseInnerBlocksProps which is no more experimetal
- Using a custom plugin to capture input data via Ajax and PHP
- Python with wordpress plugin
- Display post lists in 2nd paragraph
- Map Custom Registration Fields to WordPress User Roles
- How to remove plug in styles for WPForms Lite [closed]
- Not able to add option in Sub-Menu under page
- How to stop activating a plugin and show admin notice when dependent plugins minimum version is not met
- Using a post-signup hook to get user details
- How to apply a patch via plugin?
- Fixing WordPress’s Bug (failed to send buffer of zlib output compression) results in “White Screen of Death”
- Disable woocommerce cookies and delete cart data automatically
- Ajax contact form widget plugin data not insert in database
- link bbpress forum discussion to blogposts
- Install Plugin via Code
- code is working properly in Core PHP but writing coding in WordPress
- Combine scripts from all extensions of the plugin when an extension is activated