I have loop and I want to get the amount of posts on a current page. So I try:
<?php $post_number = $wp_query->post_count; ?> <?php echo($post_number) ; ?> <?php while ( have_posts() ) : the_post();?> <?php get_template_part( 'post', get_post_format() );?> <?php endwhile; ?>
but it doesn’t work. So how can I get amount of posts?
Read more here: Get the amount of posts on a current page