Support » Fixing WordPress » passing additional variables to a query

  • How can we add more arguments to an existing query? Suppose I have in my theme

    if (!$blog_query) $blog_query = $wp_query;
    while( $blog_query->have_posts() ) : $blog_query->the_post();

    AND I want to add to the existing qurey two arguments before passing, say

    'orderby' => 'post-title',
    'order' => 'ASC',

    How can I add these to the existing $blog_query ??

Viewing 1 replies (of 1 total)
  • Try using this:

    global $wp_query;
    if (!$blog_query) $blog_query = query_posts(
          array('orderby' => 'title', 'order' => 'ASC')
Viewing 1 replies (of 1 total)
  • The topic ‘passing additional variables to a query’ is closed to new replies.