0
votes

In wordpress, I am showing a count# of posts based on various custom taxonomies. I have retrieved this count using wp-query->found_posts used in functions.php file (used tax-query). I want to have this count number as hyperlink to show details of the posts. Any suggestion on how to get this done?

I first tried to pass the WP_Query object to the php which contains the post data but obj->found_posts did not work in the php file.

1

1 Answers

0
votes

You will need to capture posts' IDs from within the WP_Query you're running.

Example:

$post_ids = array();
while ( $wp_query->have_posts() ) : $wp_query->the_post();
    $post_ids [] = get_the_ID() ;
endwhile;

Later on, you can use these IDs however you want.