run javascript with in_category
-
Hi there, I want to use in_category to run a little javascript in only one of my categories. I’m using this code just above the </head> tag:
<?php if ( have_posts() ) { the_post(); rewind_posts(); } if ( in_category(4) ) { echo ""; } ?>Once this works correctly I’ll put the javascript into the if statement. It currently puts the
<br />in category 4 but it’s also doing it on the index.php page. I’m assuming this is because the index.php page is currently displaying posts from category 4, but how can I stop this from happeneing?Thanks.
The topic ‘run javascript with in_category’ is closed to new replies.