tags:

views:

23

answers:

1

I have a client who has WordPress installed on IIS (php5, fast cgi) and is having an issue with my menu not showing up. Ironically, if he reverts to my previous theme version, the menu shows fine. Since I changed the query between the two versions, I'm wondering if someone might be able to spot the problem in the latter.

Previous version query appears to work fine:

    global $post;
    $cat=get_cat_ID('top-menu');
    $catHidden=get_cat_ID('hidden');
    $count=0;
    $mypostsheader = get_posts(array('cat' => "$cat,-$catHidden",'showposts' => $cb2_current_count));
    $mypostsheader2 = get_posts(array('cat' => "$cat,-$catHidden",'showposts' => -1));
    $mypostsheadercount = count($mypostsheader2);

    if($mypostsheader)
    {
    $current_page = get_post( $current_page );
    ?>

However, the current version uses a bit different code logic to build the menu. This does not work under the same setup (but works on Apache fine)

 $cat=get_cat_ID('top-menu'); 
 $catHidden=get_cat_ID('hidden');
 $myqueryTopMenu = new WP_Query();
 $myqueryTopMenu->query(array(
  'cat' => "$cat,-$catHidden",
  'post_not_in' => get_option('sticky_posts')
 ));
 $mypostsheadercount = $myqueryTopMenu->found_posts;

 if($mypostsheadercount > 0)
 {
 global $post;
 $mypostsheader = get_posts(array('cat' => "$cat,-$catHidden",'showposts' => $cb2_current_count));
 $current_page = get_post( $current_page );
 ?>
+1  A: 

I can't see how IIS is affecting this - are you sure both environments are running the same WordPress version?

I also recommend using posts_per_page over showposts - as mentioned in the documentation, showposts is deprecated, and could be completely removed in the near future.

TheDeadMedic
After some further testing, I found that it if I change the if($mypostsheadercount > 0) to '>=' the menu gets written. So, apparently there's an issue with getting that count variable in IIS.
Scott B
BTW, I changed to posts_per_page. He's running WordPress 3.0
Scott B