Snippets

nvisionsolution Flexible Layouts Loop - CTA

Created by Kyle Street
<?php

// Call to action posts chosen through a relationship ACF field within the call to actions Flexible Layout
$cta_posts = get_sub_field( 'call_to_action' );

if ( $cta_posts ) :

    // Loop through the chosen Call to action posts
    foreach( $cta_posts as $post ) :

        // Setup the post and display the Flexible Layouts that create that "Call to action component"
        setup_postdata( $post );
        get_template_part( 'partials/cta-flexible-layouts/flexible', 'layouts-loop' );

    endforeach;

    wp_reset_postdata(); // IMPORTANT

endif;

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.