Last active
February 12, 2018 05:55
-
-
Save senooat/9f5529fab6282356b94b15abaed2fd04 to your computer and use it in GitHub Desktop.
『Advanced Custom Fields』のアドオンThe Repeater Field(繰り返しフィールド) テンプレートサンプル
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Template Name: スタッフ紹介 | |
*/ | |
?> | |
<?php get_header(); ?> | |
<main class="main"> | |
<?php if (have_posts()): while (have_posts()) : the_post(); ?> | |
<article id="post-<?php the_ID(); ?>" class="pages"> | |
<section class="pages__ttl"> | |
<?php the_title( '<h1><span class="ttl02">', '</span></h1>' ); ?> | |
<p><?php edit_post_link(); ?></p> | |
</section> | |
<section class="pages__body"> | |
<?php | |
if( have_rows('staffgroup') ): | |
while ( have_rows('staffgroup') ) : the_row(); | |
?> | |
<?php if( get_sub_field('image') ): ?> | |
<?php $thumb = wp_get_attachment_image_src( get_sub_field('image') , 'full' ); //thumbnail, medium, large, full ?> | |
<div class="thumb"><img src="<?php echo $thumb[0]; ?>" width="<?php echo $thumb[1]; ?>" height="<?php echo $thumb[2]; ?>" alt=""></div> | |
<?php endif; ?> | |
<?php if( get_sub_field('name') ): ?> | |
<h1><?php the_sub_field('name'); ?></h1> | |
<?php endif; ?> | |
<?php if( get_sub_field('comment') ): ?> | |
<p><?php the_sub_field('comment'); ?></p> | |
<?php endif; ?> | |
<hr> | |
<?php | |
endwhile; | |
endif; | |
?> | |
</section> | |
<nav class="pages__nav"> | |
<?php previous_post_link("%link", "< %title"); ?> | |
<?php next_post_link("%link", "%title >"); ?> | |
</nav> | |
</article> | |
<?php endwhile;endif; ?> | |
</main> | |
<?php get_footer(); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment