WordPress 検索ページ

※search.php
<?php
 検索スラッグå–å¾—
 $s = $_GET['s'];
 
 æ¡ä»¶æ–‡ã¸åŸ‹ã‚è¾¼ã¿
 $setting="s=${s}&posts_per_page=100";
 
 設定
 query_posts( $setting );
?>

<h2><?php the_search_query(); ?>ã®æ¤œç´¢çµæžœ : <?php echo $wp_query->found_posts; ?>ä»¶</h2>
<!-- 投稿情報 loop -->
<?php if(have_posts()) : ?>
 <?php while(have_posts()):the_post() ?>
  <h3><?php the_title(); ?></h3>
  <div class="post">
   <?php if (has_post_thumbnail()) : ?>
    <p class="postThumbnail"><?php the_post_thumbnail(); ?></p>
   <?php endif; ?>
   <p><?php the_content('詳細ã¯ã“ã¡ã‚‰'); ?></p>
  </div><!– /post –>
 <?php endwhile; ?>
<?php else: ?>
 <div class="post">
  <p>該当記事無ã—</p>
 </div>
<?php endif; ?>

Follow me!