I need some way to hide theme built in widget from one category.So when the post is from category X on that post hide that widget. I would use plugin for it, but since it's not drag and drop widget I can't. It's a ticker list which is built inside the theme. I have tried with <?php if(!in_category('X')) : ?>
like I disabled one other, but this is <ul>
list, and my solution ended with error.
This is the code with example what I've tried, and even tried to change position of this in_category()
but no luck. Perhaps it needs to be done inside theme function with filter but i didnt find a way or code for it.
The code in header.php
:
<div id="ticker">
<span class="ticker-heading"><?php _e( "Don't Miss", 'mvp-text' ); ?></span>
<ul class="ticker-list">
<?php if(!in_category('X')) : ?><?php else : ?><?php $recent = new WP_Query(array( 'tag' => get_option('gd_ticker_tags'), 'showposts' => get_option('gd_ticker_num') )); while($recent->have_posts()) : $recent->the_post();?>
<li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li>
<?php endwhile; ?>
</ul>
</div><!--ticker-->