• Resolved batooo

    (@batooo)


    Hey all.
    I need little help. I use wordpress latest version and there is functions to query posts from category. Also there is function to get category id.

    So i can make query for exact category like

    <?php query_posts('cat=30&orderby=comment_count'); ?>
    <?php while (have_posts()) : the_post(); ?>
    <li style="list-style:none"><b><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></b></li>
    <?php endwhile;?>

    to get category id , code is
    get_query_var('cat')

    but when i try to use

    <?php query_posts('cat=get_query_var('cat')&orderby=comment_count'); ?>
    <?php while (have_posts()) : the_post(); ?>
    <li style="list-style:none"><b><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></b></li>
    <?php endwhile;?>

    i get error.

    What is right syntax to make it works?

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘query posts by comment_count and category id’ is closed to new replies.