Last active
June 19, 2018 23:39
-
-
Save dividezigns/92b2903d3fc23cf6cdc4a0fe1d0c0fdb to your computer and use it in GitHub Desktop.
This code will use ACF's relationship field to display a WP Forms. Place this code snippet in your single template file located in your child theme directory.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$posts = get_field('wp_forms'); | |
if( $posts ): | |
foreach( $posts as $post): | |
$form_id = get_the_ID(); | |
echo do_shortcode('[wpforms id="' . $form_id . '"]'); | |
endforeach; | |
wp_reset_postdata(); | |
endif; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment