topページで使うsection内のhtmlタグメモ【WordPress】

Wordpress

トップページでカテゴリ別に記事一覧を並べたい時なんかに使う、

ひとつの<section>〜</section>のコードを書き置きます。

<section class="section-contents" id="shop">
 <div class="wrapper">
  
  <span class="section-title-en"><?php the_field('english_title') ?></span>
  <h2 class="section-title"><?php the_title(); ?></h2>
  <p class="section-lead"><?php echo get_the_excerpt(); ?></p>

  <ul class="shops">
   <?php
    if (have_posts()) :
    while (have_posts()):the_post();<li class="shops-item">
   ?>

   <a class="shop-link" href="<?php the_permalink(); ?>"> 
      <div class="shop-image">
       <?php the_post_thumbnail('common'); ?>
      </div>
   <div class="shop-body">
      <p class="name"><?php the_title(); ?></p>
      <p class="location"><?php the_field('location'); ?></p>
      <p class="location"><?php echo the_excerpt(); ?></p>
      <div class="buttonBox">
       <button type="button"class="seeDetail">MORE</button>
      </div>
   </div>
 </a>
</li>

<?php
endwhile;
endif;
?>
</ul>

  <div class="section-buttons">
    <button type="button"class="button button-ghost" onclick="javascript:location.href= '<?php echo esc_url(home_url('shop')); ?>';">一覧を見る</button>
  </div>
 </div>
</section>

見にくくてすいません〜

タイトルとURLをコピーしました