Need help coding error - <php Query>

Discussion in 'PHP' started by Nystul, Nov 24, 2009.

  1. #1
    can anyone tell me if there's anything wrong with this ? Yes it works, but it makes my other php not working.

    <?php query_posts('showposts=1&cat=1'); ?>
    <?php while (have_posts()) : the_post(); ?>
    <a href="<?php the_permalink() ?>" title="Permanent Link to <?php the_title(); ?>" rel="nofollow"><img src="http:/abc.com/images/<?php $values = get_post_custom_values("Image"); echo $values[0]; ?>" style="padding:3px; border:1px solid #AEAEAE;" alt=" " width="285" id="leadpic" /></a>
    <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>" class="title"><?php the_title(); ?></a>
    <?php the_excerpt(); ?>
    <div class="right"><br /><a href="<?php the_permalink() ?>" rel="nofollow" title="Permanent Link to <?php the_title(); ?>">Continue reading &raquo;</a></div>
    <?php endwhile; ?>

    It shows exactly what i want, however it makes my sidebar stuffs not working

    SIDEBAR
    <?php if (is_home()) { ?>
    <p>ABC</p>
    <?php } ?>



    ** Can someone let me know! Thanks!
     
    Nystul, Nov 24, 2009 IP
  2. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #2
    Wats the error u get ??
     
    Bohra, Nov 24, 2009 IP
  3. ads2help

    ads2help Peon

    Messages:
    2,142
    Likes Received:
    67
    Best Answers:
    1
    Trophy Points:
    0
    #3
    What do you mean by "not working"?
     
    ads2help, Nov 24, 2009 IP
  4. kuzmanin

    kuzmanin Peon

    Messages:
    242
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    are you sure that php function: is_home() returns true?
    because your sidebar as you posted it has if condition
     
    kuzmanin, Nov 24, 2009 IP
  5. Nystul

    Nystul Well-Known Member

    Messages:
    3,077
    Likes Received:
    40
    Best Answers:
    0
    Trophy Points:
    175
    #5
    Thanks for trying to help - the problem is that

    My sidebar will not show the home true statement, when the query was used

    However when i remove the query post php, my sidebar functions normally (shows during homepage, and not during other pages)

    I tried all ways and means, can other php leads to this problem ? maybe i didnt close a php properly or something ?
     
    Nystul, Nov 24, 2009 IP
  6. Nystul

    Nystul Well-Known Member

    Messages:
    3,077
    Likes Received:
    40
    Best Answers:
    0
    Trophy Points:
    175
    #6
    Gosh .. figured it out ! hah. I need this

    <?php wp_reset_query(); ?>

    !!
    Thanks for all who looked in my thread!
     
    Nystul, Nov 24, 2009 IP