Support

Account

Home Forums Backend Issues (wp-admin) Control layout of ACF in backend – only possible through Flexible Content?

Unread

Control layout of ACF in backend – only possible through Flexible Content?

  • Hey there,

    I’m sure I’m probably not understanding the methods with the Flexible Content type, but I would like to arrange the custom fields on the backend so that, for example, the user can upload images from a set of custom fields that are in one row of three, then another row of four, etc.

    It seems that the only way to control the look of the ACF layout is through the Flexible Content type – if so, how do I get the ability to go into a layout row and print an image somewhere deep in a page layout, and then from within that same layout row, print another image somewhere else on the page?

    It looks like through the examples of the Flexible Content, I just loop through each row, but how do you add HTML divs, for example, inside the code examples, such as:

    <?php
     
    // check if the flexible content field has rows of data
    if( have_rows('homepage_content') ):
     
         // loop through the rows of data
        while ( have_rows('homepage_content') ) : the_row();
     
            if( get_row_layout() == 'feed_button_images' ):
     			
            	$image = get_sub_field('lookbook_feed');
    				echo '<img src="' . $image['sizes']['large'] . '" width="" height="" alt="' . $image['alt'] . '" title="' . $image['title'] . '" />';
    			$image = get_sub_field('tumblr_feed');
    				echo '<img src="' . $image['sizes']['large'] . '" width="" height="" alt="' . $image['alt'] . '" title="' . $image['title'] . '" />';
     
            elseif( get_row_layout() == 'about_us_mailchimp_images' ): 
     
    			$image = get_sub_field('about_us_image');
    				echo '<img src="' . $image['sizes']['large'] . '" width="" height="" alt="' . $image['alt'] . '" title="' . $image['title'] . '" />';
    			$image = get_sub_field('mailchimp_image');
    				echo '<img src="' . $image['sizes']['large'] . '" width="" height="" alt="' . $image['alt'] . '" title="' . $image['title'] . '" />';
     
            endif;
     
        endwhile;
     
    else :
     
        // no layouts found
     
    endif;
     
    ?></div>
    <div id="4"><?php 
    $image = get_sub_field('mailchimp_image');
    	echo '<img src="' . $image['sizes']['large'] . '" width="" height="" alt="' . $image['alt'] . '" title="' . $image['title'] . '" />';
    
     ?>
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.