WordPress.org

Ready to get started?Download WordPress

Forums

$found_posts (3 posts)

  1. rafaelvelzi
    Member
    Posted 1 year ago #

    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?

  2. wpismypuppet
    Member
    Posted 1 year ago #

    $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).

  3. rafaelvelzi
    Member
    Posted 1 year ago #

    dont work

Topic Closed

This topic has been closed to new replies.

About this Topic