if is_category not working
-
I have searched on this, but I am having a difficult time finding anything as it seems no one has had this problem. Search terms used “if is_category not working”
I am using the if statement in the footer to call javascript to choose a javascript file for tabs. Depending on the javascript 2,3 or 4 tabs are shown based on what (type of) page you are on. This works fine for the home page and the single posts.
However, somehow it is not loading the javascript in the categories. It is loading the is_home javascript in the parent category, and nothing in the child category. If I leave out the is_home statement no javascript is loaded in the categories. I have tried is_category, in_category as well (as well as a number of other things).
In the theme file I have:
<?php if ( is_home() ) { ?> <script type="text/javascript" src="<?php echo get_option('home'); ?>/wp-content/themes/arthemia/scripts/widget-easy-tabs-2.js"></script> <?php } else { ?><?php } ?> <?php if ( is_archive() ) { ?> <script type="text/javascript" src="<?php echo get_option('home'); ?>/wp-content/themes/arthemia/scripts/widget-easy-tabs-3.js"></script> <?php } else { ?><?php } ?> <?php if ( is_single() ) { ?> <script type="text/javascript" src="<?php echo get_option('home'); ?>/wp-content/themes/arthemia/scripts/widget-easy-tabs-4.js"></script> <?php } else { ?><?php } ?>
Does anyone know how to figure this out, or who can point me in the right direction? Many thanks.
- The topic ‘if is_category not working’ is closed to new replies.