Support

Account

Forum Replies Created

  • Hi John,

    Could you please advise in light of your suggestion above with 5.5.x as to how I can modify the below to change the ordering?

    
    $sub_categories = get_field('featured_categories');
    foreach ($sub_categories as $sub_category):
        echo $sub_category->name;
    endif;
    

    sub-category is a Taxonomy field with the return value as Term Object

  • Hey John,

    Thanks for the advice. I’ve changed my code to the below, and the icon now works, however the loop seems to break after the first record. There should be 3 records, but I’m now only getting one record in the loop. What am I missing or doing wrong?

    
    <?php if( have_rows('unique_selling_points') ): ?>
    
    		<div class="wrapper">
    
    			<div class="usp-list equal-heights">
    
    				<?php
    				$n = 0;
    				while( have_rows('unique_selling_points') ): the_row();
    					$n++;
    
    					$icon = get_sub_field('icon');
    					$heading = get_sub_field('heading');
    					$intro = get_sub_field('intro');
    					$text = get_sub_field('text');
    					?>
    					<article class="unit">
    						<?php
    						if ($icon):
    							$post = $icon;
    							setup_postdata($post);
    							?>
    							<i class="has-circle bg-brand2">
    			                    <svg class="icon-<?php the_field('css'); ?>">
    			                        <use xlink:href="<?php echo get_template_directory_uri(); ?>/images/icons/icons.svg#icon-<?php the_field('css'); ?>"></use>
    			                    </svg>
    			                </i>
    						    	<?php
    						    wp_reset_postdata();
    						endif;
    				        ?>
    						<h1 class="heading4"><?php echo $heading; ?></h1>
    						<p class="intro"><?php echo $intro; ?></p>
    						<?php if( $text ): ?>
    							<div id="usp-<?php echo $n?>" class="reveal">
    								<?php echo $text; ?>
    							</div>
    							<a href="javascript:void(0);" title="Read more" class="btn hover2">
    								Read more
    								<i class="down">
    				                    <svg class="icon-arrow-down">
    				                        <use xlink:href="<?php echo get_template_directory_uri(); ?>/images/icons/icons.svg#icon-arrow-down"></use>
    				                    </svg>
    				                </i>
    							</a>
    						<?php endif; ?>
    					</article>
    
    				<?php endwhile; ?>
    
    			</div>
    
    		</div>
    
    	<?php endif; ?>
    
  • Hi John,

    Correct, $icon['css'] is a custom field for the icon custom post object I have created.

Viewing 5 posts - 1 through 5 (of 5 total)