you can check with the_posts
hook if your shortcode exists and only enqueue the style if so :
function check_for_shortcode($posts) {
if ( empty($posts) )
return $posts;
$found = false;
foreach ($posts as $post) {
if ( stripos($post->post_content, '[CHANGE_TO_YOUR_SHORT_CODE') )
$found = true;
break;
}
if ($found){
$url = get_bloginfo( 'template_directory' );
wp_enqueue_style( 'my_login_Stylesheet',$url.'/my_login_Stylesheet.css' );
}
return $posts;
}
add_action('the_posts', 'check_for_shortcode');
Related Posts:
- how to include other plugins css files in a shortcode?
- shortcode doesn’t work
- Plugin form unable to process
- Layout shop page: resize images and columns
- How extend shortcode default values for a plugin?
- How to generate CSS from a shortcode within a plugin
- Can someone please tell me what is wrong with my plugin?
- Redirect to another page using contact form 7? [closed]
- How to add a dvi tag to a shortcode then change a generated text using jQuery
- Override/ignore CSS from active theme as not to interfere with my custom CSS
- Form Plugin for Api Requests which is used via Shortcode
- Echo out element to another page.
- General Term for this form Field
- Page takes on two different formats
- WP Plugin CSS not being applied to page
- Is there a function to search for a wildcard value when calling a shortcode?
- How can I add a zip code service availability checker in WordPress without Woocommerce? [closed]
- Display file contents within Plugin
- Restricting a Plugin to Only Load its CSS and JS on Selected Pages?
- Autogenerate wordpress shortcodes using array?
- Enqueue style inside shortcode but its loaded at the bottom of page (before footer scripts)
- Prevent CSS/JS loading when plugin is not used
- Styling readme.html in plugin?
- how to show database content in wordpress post
- Only execute jQuery function(on document ready) on the page has shortcode from plugin [duplicate]
- echo do_shortcode is not working on theme’s template
- How to override my plugin’s php classes with duplicates that are in my child theme folder
- Shortcode to generate and save password in a file
- Overriding Attributes values in Shortcode Plugins
- Demystifying and understanding shortcode nomenclature
- How to modify shortcode attributes with data from current post
- Add htmlentities and/or shortcode into data-attributes
- Custom form action to handle data inside a plugin
- tag breaks shortcode output (other solutions don’t work)
- Allow users of my plugin to define their own shortcode rather than use mine?
- Child Pages Short Code plug-in and hover capabilities?
- add_shortcode is not working in plugin where others are working
- How to hide CSS by default and show on button press
- Submit page limited in time to upload image
- Ajax fail and get 504 error
- Some code in shortcode function being ignored
- How to get DEFER or ASYNC attribute to appear when I add a stylesheet with wp_enqueue_style from a plugin? [duplicate]
- plugin shortcode output
- What is @Action in WordPress?
- Stop Plugin from Getting Styles from Other Plugin
- Where are theme codes located for WordPress?
- Is there a way to embed a Google Docs form in a page without using plugins?
- How to have sample page for each new register users in a membership website
- Submit Form data to another page via Ajax (WordPress Way)
- using do_shortcode
- Modify page title and subtitle with a plugin
- how to prevent all css and javascripts files from loading
- Front-end CSS Library for plugin [closed]
- Add Shortcode tag in Widget/Sidebar
- Infinite scroll messing up nth:of-type
- WPTouch – how to remove shortcodes or make shortcodes function
- Custom shortcode for displaying user based on a role parameter
- WordPress Plugin Insert Html Code with Shortcode
- Get all the URLs of the pages that uses a specific shortcode
- Creating a form and displaying entry data as a table
- Not able to override plugin’s default css rules
- Select Form Element Not Saving from Plugin Options
- insert an html tag using php plugin
- Best practice when modifying plugins CSS [duplicate]
- how to check if a shortcode is used more than one time in the same post
- Rename Smart YouTube’s httpv back to http for all posts
- How do I work with the SlideDeck plug-in?
- Why is adoptStyles-css stylesheet link added to every page?
- Custom Plugin scripts from admin working in frontend
- Themes conflicts and overrides my WordPress Support widget Plugin styles
- How to use a shortcode or an application to dynamically embed content from one WordPress site to another?
- User loggedin as Subscriber form not sending
- Menu not closing after clicking – WordPress – Elementor
- Thumbnail image doesn’t show up in Shortcode output
- list of custom post by custom field in frontend
- JS working when used normally but not in wordpress
- WordPress Shortcodes – Return $Variable
- shortcodes not working [dt_carousel & [dt_fancy_image
- Why is my form going to frontend on html form submission present on the php files inside my custom plugin?
- wp plugin adds “pagespeed.css” after each css file
- How to submit custom form data using ajax to HubSpot form?
- Caching of combined CSS and JS fails because of losing MIME types through combining by PHP
- How to remove a css class for any wordpress page
- How can I automatically send an email with an excel file containing submissions for a form rather than an email per submission?
- Speed issues because of CSS & JavaScript
- $POST variable is empty in receiving php add-on function but can be seen by jscript function
- wordpress Shortocode running twice?
- Shortcode in a blog post, footer and related products stop working
- Include plugin form in the home page
- Using “excerpt_more” filter for a specific post type
- Linking Plugin Files to WP
- Strip shortcode from excerpt [duplicate]
- How to load css files in a specific order
- Element works, but not on wordpress site [duplicate]
- Next and Previous Pagination button not displaying in WordPress
- How to modify submit button on GravityForms
- Shortcode to do math with url variables
- How to get URL param for pagination in shortcode?
- Is there a membership plugin which offers the ability to hide content based on css rules?
- How to add an active state class to my info box