Support

Account

Home Forums ACF PRO Duplicate a field group to another page

Unread

Duplicate a field group to another page

  • I’ve setup a (repeater) field group which works great. I can add an icon/title/paragraph and duplicate this multiple times to create a row of ‘features’.

    This field is used on a certain type of ‘post’ page and as the text can be different for each page, it’s not a problem that the layout needs to be created from scratch again on every page.

    My problem/question is, I want to use the same type a field group on the homepage. I thought I could just apply the same field group to the homepage but my problem is once the content is added to the homepage, I need to load the exact same content onto another page. So I thought maybe creating a new field group with basically the exact same fields/markup but a different name might be needed – is that the best way to handle this?

    So after I’ve done that I need to load the exact same content onto another page. What is the best way to achieve this without re-entering the content on the additional page – or is that not possible?

    Or would you essentially have one ‘master’ page where the content is added and then it can be automatically pulled into a select template?

    For reference my code currently looks like like:

    
    <?php if( have_rows('feature_item') ): ?>
    
    	<section class="band band--tint">
    		<div class="wrap">
    			
    			<ul class="features">
    	
    			<?php while( have_rows('feature_item') ): the_row(); 
    		
    				// vars
    				$icon = get_sub_field('icon');
    				$title = get_sub_field('title');
    				$text = get_sub_field('text');
    		
    				?>
    		
    				<li class="features__item">
    		
    					<?php if( $icon ): ?>
    						<div class="features__icon-wrap">
    							<img src="<?php echo $icon['url']; ?>" alt="<?php echo $icon['alt'] ?>" class="icon" />
    						</div>
    					<?php endif; ?>
    		
    					<?php if( $title ): ?>
    						<h3 class="features__title"><?php echo $title; ?></h3>
    					<?php endif; ?>
    					
    					<?php if( $text ): ?>
    						<p class="features__text"><?php echo $text; ?></p>
    					<?php endif; ?>
    		
    				</li>
    		
    			<?php endwhile; ?>
    			
    			</ul>
    
    		</div>
    	</section>
    
    <?php endif; ?>
    
Viewing 1 post (of 1 total)

The topic ‘Duplicate a field group to another page’ is closed to new replies.