function check_for_shortcode($posts) {
if ( empty($posts) )
return $posts;
// false because we have to search through the posts first
$found = false;
// search through each post
foreach ($posts as $post) {
// check the post content for the short code
if ( stripos($post->post_content, 'YOUR_SHORTCODE') )
// we have found a post with the short code
$found = true;
// stop the search
break;
}
if ($found){
// $url contains the path to your plugin folder
$url = plugin_dir_url( __FILE__ );
wp_enqueue_style( 'my_login_Stylesheet',$url.'plugin_styles.css' );
}
return $posts;
}
// perform the check when the_posts() function is called
add_action('the_posts', 'check_for_shortcode');
Prashant Walke, with over 10 years of experience as a web developer, currently holds the position of Technical Lead at Parkar Digital. He brings a wealth of expertise in sophisticated website development, showcasing proficiency in PHP, Python, NodeJS, Angular, VueJs, MySQL, PostgreSQL, WordPress, and Laravel.
For most recent news you have to visit internet and on world-wide-web I found this web site as a best site for latest updates.
Hello There. I found your blog using msn. This is a really well written article. I’ll be sure to bookmark it and come back to read more of your useful information. Thanks for the post. I’ll certainly return.
I know this web site gives quality depending articles or reviews and other information, is there any other website which provides such data in quality?
Hey there! I just wanted to ask if you ever have any trouble with hackers? My last blog (wordpress) was hacked and I ended up losing months of hard work due to no back up. Do you have any methods to stop hackers?
Excellent site you’ve got here.. It’s difficult to find good quality writing like yours nowadays. I seriously appreciate individuals like you! Take care!!
Have you ever considered about including a little bit more than just your articles? I mean, what you say is fundamental and everything. But think about if you added some great pictures or videos to give your posts more, “pop”! Your content is excellent but with images and videos, this site could definitely be one of the best in its field. Superb blog!