WordPress working with ACF Pro

One of the best features of the WordPress plugin “Advanced Custom Field (ACF)” is the ability not just to add custom fields, but by extension the abilty to create field type called ‘repeat’.
This lets editors add rows of content that is associated with a field  (in a crude way it’s like having relational data).

So, having created the field and poplated it with data (for example, adding multiple images to a post to are presented in a  table)

<?php
// test if the ACF field has rows

if( have_rows(‘image_sliders’) ):
   // run through the rows to get elements in each row

    while ( have_rows(‘image_sliders’) ) : the_row();
      //  get_sub_field is the key

        $theImage=get_sub_field(‘slider_image’);
        $theImg=$theImage[‘url’];
       $theLink=get_sub_field(‘slider_image_url’);
       echo “<div class=’imagecon’><a href=”.$theLink.”><img src=”.$theImg.”></a></div>”;
   endwhile;
   else :
endif;

// clear query after use
wp_reset_query();

?>

Adwords (1)

Branding (13)

CMS (3)

CSS (6)

Graphic Design (6)

Javascript (1)

PHP (3)

SEO (5)

tech support (5)

Web Design (10)

Web Development (10)

Wordpress (17)

Wordpress plugins (3)