Doesn’t seem to work. I apologize about this as i’m not really familiar with PHP yet.
This is how I used your code:
<div class="row process-content">
<?php
$i = 0;
$count = count(get_field('processes')); // has total count of rows
while (have_rows('processes')) {
the_row();
if ($i<=2) { $i++; ?>
<div class="left-side">
<div class="item" data-item="<?php the_sub_field('step_number'); ?>">
<h5><?php the_sub_field('step_title'); ?></h5>
<p><?php the_sub_field('step_description'); ?></p>
</div> <!-- END .item -->
</div> <!-- END .left-side -->
<?php } else { ?>
<div class="right-side">
<div class="item" data-item="<?php the_sub_field('step_number'); ?>">
<h5><?php the_sub_field('step_title'); ?></h5>
<p><?php the_sub_field('step_description'); ?></p>
</div> <!-- END .item -->
</div> <!-- END .right-side -->
<?php } ?>
<?php } ?>
<div class="image-part"></div>
</div> <!-- END .process-content -->
Hi James. I apologize for asking too much questions. I’m still not very familiar with PHP and just took a course about ACF.
I have tried to do this with Custom Post Type UI and this time it’s for the team section: http://tympanus.net/Freebies/HalcyonDaysTemplate/#
I did the same thing just like the last code you posted but there’s an extra slide with empty content. What am I missing?
<div id="teamSlider">
<ul class="slides">
<?php $team = new WP_Query( array(
'post_type' => 'team',
'orderby' => 'post_id',
'order' => 'ASC'
)); ?>
<?php
$li = 0;
$max_li = count($team);
?>
<li>
<?php while($team->have_posts()) : $team->the_post(); $li++; ?>
<div class="col-md-4 wp5">
<?php if(has_post_thumbnail()) {
the_post_thumbnail();
} ?>
<h2><?php the_title(); ?></h2>
<p><?php the_content(); ?></p>
<div class="social">
<ul class="social-buttons">
<?php if(get_field('social_account')) : while(has_sub_field('social_account')) : ?>
<li>
<a href="<?php the_sub_field('team_social_link'); ?>" class="social-btn">
<?php the_sub_field('team_social_icon'); ?>
</a>
</li>
<?php endwhile; endif; ?>
</ul>
</div> <!-- END .social -->
</div> <!-- END .col-md-4 .wp5 -->
<?php if($li % 3 == 0 && $li != $max_li) { ?>
</li><li>
<?php } ?>
<?php endwhile; ?>
</li>
</ul> <!-- END .slides -->
</div> <!-- END #teamSlider -->
It works perfect. I appreciate your help James. Thank you so much
Thank you James. It works but now there is a 3rd extra slide with empty content where it’s supposed to be only two slides from the original html demo:(http://tympanus.net/Freebies/HalcyonDaysTemplate/#)
see attached image
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.