SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Evangelist stonedeft's Avatar
    Join Date
    Aug 2009
    Posts
    590
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Wordpress query_post question

    Hello forums,

    Im kinda stuck with my function. Im tryng to query post on certain categies but it just displays the lates entries

    PHP Code:
    function footLink($cat){
    query_posts('cat=$cat'); 
    if ( have_posts() ) : while ( have_posts() ) : the_post();
    ?>
    <li><a href="<? the_permalink()?>"><? the_title(); ?></a></li>
    <?
    endwhile; endif;   
    wp_reset_query(); 
    }

    PHP Code:
    echo footLink(12); 
    this one just displays the recent entries and not posts from the category id 12

    Any idea why?
    Don't Panic

  2. #2
    SitePoint Evangelist stonedeft's Avatar
    Join Date
    Aug 2009
    Posts
    590
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    NVM

    it should be query_posts('cat='.$cat.'');
    Don't Panic


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •