显示自定义字段

时间:2015-11-16 02:07:31

标签: php wordpress advanced-custom-fields

如何在我网站的主页上显示三个最近的项目帖子,我正在使用自定义字段中继器。

<?php if( have_rows('recent_project') ): ?>
<div class="row-full-width mb">

  <?php while( have_rows('recent_project') ): the_row();

    // vars new project
    $project_image         = get_sub_field('project_image');
    $project_title         = get_sub_field('project_title');
    $project_link          = get_sub_field('project_link');
  ?>

  <div class="col-sm-6 col-md-3 box row-no-padding scrollimation scale-in fade-in">
        <a class="hoverfx-img-contra" href="<?php echo $project_link; ?>" target="_blank">
        <div class="figure">
            <?php echo $project_title; ?>
        </div>
        <div class="overlay">
        </div>
        <img src="<?php echo $project_image['url']; ?>" alt="<?php echo $project_image['alt']; ?>" class="img-responsive scrollimation scale-in fade-in">
        </a>
    </div>
  <?php endwhile; ?>
</div>
<?php endif; ?>

0 个答案:

没有答案