in_category outside the loop
-
Hi guys,
I’m setting up a second sidebar where I put the “submenus” of my site. I’m trying to use the in_category tag in this sidebar template, however it’s not working. A friend of mine told me the problem was because it was outside the loop, but in the codex it says it may be used outside the loop. So could someone take a look at it, please?My code:
<ul class="submenu"> <?php if ( is_category(10) || is_single() && in_category('10')): ?> <li><a class="icone-temas" href="<?php echo get_category_link(11);?> ">Temas</a></li> <li><a class="icone-plugins" href="<?php echo get_category_link(12);?> ">Plugins</a></li> <?php elseif ( is_category(13) || is_single() && in_category('13')): ?> <li><a class="icone-dicas" href="<?php echo get_category_link(14);?> ">Dicas</a></li> <li><a class="icone-tutoriais" href="<?php echo get_category_link(15);?> ">Tutoriais</a></li> <?php elseif ( is_category(1) || is_single() && in_category('1')): ?> <?php wp_list_categories('orderby=id&show_count=1&use_desc_for_title=0&child_of=1&title_li='); ?> <?php elseif ( is_category(16) || is_single() && in_category('16')): ?> <?php wp_list_categories('orderby=id&show_count=1&use_desc_for_title=0&child_of=16&title_li='); ?> <?php endif; ?> </ul>
Thanks,
Cátia
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘in_category outside the loop’ is closed to new replies.