Counting number of images from loop

You can get images with foreach loop but first you have to print_r($images) and then get the value of the array something like this $images[‘image’] or $images[‘src’] or $images[‘url’] etc. But first check is there any record where you are getting get_sub_field(‘image’) all images. <?php if ( $images = get_sub_field(‘image’) ) : print_r($images); foreach($images as … Read more

How to make a shortcode for my WP_Query Loop? [duplicate]

I´m doing this since last year and i´m getting the shortcodes working: function my_code() { ob_start(); get_template_part(‘loop_logos’); return ob_get_clean(); } add_shortcode( ‘logos’, ‘my_code’ ); where get_template_part loads the file loop_logos.php and logos is the name shortcode [logos]. HINT When I started to do this I used to name all equal to avoid mistakes, Ex: function … Read more