Difference betwwen two PHP statements in thread

Discussion in 'PHP' started by freaky316, Aug 30, 2011.

  1. #1
    I am a new bie in PHP and presently started learning it. Apologies in this thread if I am wrong anywhere in this thread.

    Could you please explain the below two statements:

    <?php $recent = new WP_Query("cat=-<? echo $wt_featured; ?>&showposts=12"); while($recent->have_posts()) : $recent->the_post();?>

    <?php $recent = new WP_Query("cat=<? echo $wt_featured; ?>&showposts=8"); while($recent->have_posts()) : $recent->the_post();?>

    I have downloaded a Wordpress theme for my site and I am customizing that now. $wt_featured is meant for one of the 5 categories for the posts in the site and there are two panes displaying in my site with one pane containing posts of $wt_featured and other pane displaying the posts other than $wt_featured. But I wish I want 5 panes with each pane displaying posts of each categories. Is that possible to do?

    Thanks for the replies in advance.
     
    freaky316, Aug 30, 2011 IP
  2. shallowink

    shallowink Well-Known Member

    Messages:
    1,218
    Likes Received:
    64
    Best Answers:
    2
    Trophy Points:
    150
    #2
    First statement has a - in front of the $wt_featured and gets 12 posts NOT from the $wt_featured categories. The 2nd gets 8 posts from those categories.

    To get only posts from a specific category, copy the second one and replace cat=<? echo $wt_featured; ?> with cat=CATEGORY_NUMBER and you can get the category number from admin panel >posts>categories. it should look like cat=8.
     
    shallowink, Aug 30, 2011 IP