絞り込み検索を実装して、以下のようなコードで検索結果を出力出来るようになったのですが、
この検索結果が何件あったのかを取得する方法が分かりません。
調べてみても有料テーマの記事に当たってしまって上手くいかないです。
よろしくお願いします。
<section class="result-cover"> <?php $the_query = new WP_Query($args); if($the_query->have_posts()) : ?> <div class="result-title" > <h1>検索結果</h1> </div> <div class="result"> <?php while($the_query->have_posts()) : $the_query->the_post(); ?> <!-- 記事 --> <div class="gu-box"> <a href="<?php the_permalink(); ?>" class="guide2-box"> <div class="guide2-box-thumbnail"> <?php the_post_thumbnail('medium'); ?><!-- サムネ --> </div> <div class="guide2-box-txt"> <div class="guide2-box-text-ttl"><!-- タイトル --> <h1><?php the_title(); ?></h1> </div> <div class="guide2-box-text-dtl"><!-- 抜粋 --> <p><?php the_excerpt(); ?></p> </div> </div> </a> </div> <?php endwhile; wp_reset_postdata(); ?> </div> <?php else : ?> <p>該当する代理店はありませんでした。</p> <?php endif; ?> </section>