Get the required Contact Form

Question

I have 2 froms in my web site, but i need get only Selected form, for current post/page:

<?php 
$posts = get_posts(array(
    'posts_per_page'    => 1,
    'post_type'         => 'roads'
));

   if( $posts ): ?>


        <?php foreach( $posts as $post ): 

            setup_postdata( $post );

            ?>

                <?php $form_posts= get_field('form', $post->ID);
                        echo $form_posts;

                ?>
                <?php echo do_shortcode( '[contact-form-7 404 "Not Found"]' ); ?>

        <?php endforeach; ?>

        <?php wp_reset_postdata(); ?>

<?php endif; ?>

But i can get only on form, for all post/page – where i’m wrong? i want get this in my single page for post type. Thank you

0
, Lerry 6 months 0 Answers 47 views 0

Leave an answer