Reputation: 343
I want to load my style-sheet's and script's inside wordpress header to show documentation in my front-page/homepage for specific condition supply by wordpress option setting get_option('my_main_scripts')
.
Pool of values for this option setting are javascript library, javascript yui, javascript jquery, javascript dojo
and so on. All option value consist with common word javascript
.
and want to load css if any one value is selected from the pool which contains word javascript
.
So writing condition with each option using OR (||) , I think its better to grab the common word from the value and write down the condition .here is javascript
how can I get this?
<?php if ( is_home() || is_front_page() ) { ?>
<?php if (get_option('my_main_scripts') == "javascript library"): ?>
<link rel="stylesheet" href="<?php bloginfo("template_url"); ?>/css/javadoc.css" type="text/css" media="screen" />
<link rel="stylesheet" href="<?php bloginfo("template_url"); ?>/js/javadoc.dojo.css" type="text/css" media="screen" />
<link rel="stylesheet" href="<?php bloginfo("template_url"); ?>/js/javadoc.yui.css" type="text/css" media="screen" />
<link rel="stylesheet" href="<?php bloginfo("template_url"); ?>/js/javadoc.jquery.css" type="text/css" media="screen" />
<?php get_template_part('documation'); ?>
<?php endif; ?>
<?php } ?>
Upvotes: 0
Views: 335
Reputation: 26431
Use strpos.
if(strpos(get_option('my_main_scripts'),'javascript') !== false )
Also have a look at preg_match.
if(preg_match('/javascript/',get_option('my_main_scripts')))
Upvotes: 1