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;?> Code (markup): to get category id , code is get_query_var('cat') Code (markup): 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;?> Code (markup): i get error. What is right syntax to make it works?
You are trying to pass it in as a string, which is why you are having the problem. Either get the data first, and pass in the response, or concatenate the request inside the function; E.G <?php query_posts('cat='.get_query_var('cat').'&orderby=comment_count'); ?> PHP: