• Dear, my first topic. Sorry but I looked a lot in the forum and have not found the answer … and i believe it is a beginner question (sry)

    I’m needing to show the total amount of post resulting from a query, I see always in the forum is structured as follows: “$wp_query->found_posts”
    However, the theme I’m using uses the structure to make the queries as follows:

    $args=array(
    			'showposts' => 10,
    			'paged' => $paged,
    			'year' => $today["year"],
    			'monthnum' => $today["mon"],
    			'day' => $today["mday"],
    			'meta_key' => $meta_key,
    			'orderby'=> 'meta_value_num',
    			'order' => 'DESC'
    		);
    		query_posts($args);
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    How do I get the value of $found_posts query with this structure?

Viewing 2 replies - 1 through 2 (of 2 total)
  • wpismypuppet

    (@wordpressismypuppet)

    $wp_query is a global variable that will hold the information for the current loop. You should just be able to use $wp_query->found_posts anywhere on that page to get your results. If it’s not working, try globalizing $wp_query (global $wp_query at the top of the page).

    Thread Starter rafaelvelzi

    (@rafaelvelzi)

    dont work

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘$found_posts’ is closed to new replies.