I have a really strange problem:
I use the following code in my sidebar to get a specific aside for a couple of categories:
<div id="randnotiz">
<?php if(is_page(13) OR is_page(171) OR is_page(178) OR is_category(6)) { $rn = 'randnotiz_erste'; /* Erste */ } elseif(is_page(34) OR is_page(98) OR is_page(164) OR is_category(3)) { $rn = 'randnotiz_zweite'; /* Zweite */ } elseif(is_page(20) OR is_page(174) OR is_page(176) OR is_category(7)) { $rn = 'randnotiz_ue40'; } else { $rn = 'randnotiz'; }
/* MUSS ÜBERARBEITET WERDEN! IRGENDWAS MIT DEN SUBPAGES IN DER ABFRAGE! */
echo "$rn funktioniert doch";
wp_reset_query();
$temp = $wp_query;
$wp_query = null;
$wp_query = new WP_Query();
$wp_query->query('category_name='.$rn.'&showposts=1,orderby=date,order=DESC');
$temp_posts = $posts;
$posts = null;
$posts = $wp_query->posts;
while (have_posts()) : the_post();
the_content();
endwhile; ?>
</div>
Two problems:
1. This works for the categories "Erste" and "Ü40", but for my "Zweite" category, it fails to realize that it is on the page 34 (even though this is 100% correct!) so it shows the aside, that is supposed to show, if there is no category asigned (such as my "homepage" index.php).
2. On my index.php it adds 8 <br /> tags after the correctly displayed paragraph. It doesn't do that on any other page.. why does it do that?
I'm glad for any brainstorming or help I can receive, it really doesn't make any sense to me..
Problem can be seen under: http://thc.franziskaner-fc.de/wordpress/