• I try to use detail.containerPostId DOM inside the loop and Contact Form 7 simply show value=0 within the form’s hidden field.

    I understand that the shortcode need to be put on a single page/post to be able to get the value when using detail.containerPostId.

    Is there any way/method that I can get the detail.containerPostId working on the loop inside wp-query?

    I need to load the same form ID within loop but with different containerPostID to trigger different Bootstrap modal ID.

    Thank you.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    Where can we see the website in question?

    Thread Starter Syafiq Freman

    (@sapitt)

    Hi @takayukister .

    Here is the link: https://fusiotech.t9ylwynlim-95m32jpld4rv.p.runcloud.link/resources/

    If you click the “Download XXX” button, the form will popup. All the forms there uses the same Contact Form 7 ID. I want to use detail.containerPostId on the DOM but the value is 0.

    I test it on single post, it’s working fine but not inside loop.

    Thanks sir..

    Plugin Author Takayuki Miyoshi

    (@takayukister)

    The modal resources are obviously out of loop. That is why the _wpcf7_container_post (detail.containerPostId) is 0.

    Thread Starter Syafiq Freman

    (@sapitt)

    I put it within the loop and each modal will load different titles and pictures mean it’s within the loop.

    <!– Start Looping –>
    <?php $the_query = new WP_Query(array(
    ‘orderby’ => ‘DESC’,
    ‘post_type’ => ‘library’,
    ‘posts_per_page’ => 30,
    ‘post_status’ => ‘publish’
    )); if ( $the_query->have_posts() ) { while ( $the_query->have_posts() ) { $the_query->the_post(); ?>

    <?php echo do_shortcode( ‘[contact-form-7 id=”1971″ title=”Download Entries”]’ ); ?>

    <?php } } else { } wp_reset_postdata(); ?>`

    I tested on default query without “library” the custom post type also got 0 value.

    Thanks sir @takayukister

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Using detail.containerPostId in WordPress Loop’ is closed to new replies.