Guest User

Untitled

a guest
Nov 16th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. <div id="whitepaper" class="home_whitepaper_bg w-clearfix">
  2. <?php $lpcnt=0; if(have_rows('whitepaper_list')): ?>
  3. <?php while(have_rows('whitepaper_list')): the_row(); $lpcnt++; ?>
  4. <!-- Making rows for content, looping through and counting loops = lpcnt -->
  5.  
  6. <!--
  7. ... Other content ...
  8. -->
  9.  
  10. <?php
  11. the_sub_field('whitepaper_download_form');
  12. ?>
  13. <?php
  14. $pdf=get_permalink().'?download='.get_sub_field('whitepaper_pdf');
  15. ?>
  16. <a data-fancybox data-src="#whitepaper_popup_<?php echo $lpcnt; ?>" data-redirect="<?php echo $pdf; ?>" href="javascript:;" class="whitepaper_download_link w-inline-block w-clearfix">
  17. <!-- Here's the buttons for fancybox popups. They use the loop count to build a specific url - this is info I want later! -->
  18.  
  19. <div id="whitepaper_popup_<?php echo $lpcnt; ?>" class="whitepaper_popup">
  20. <!-- using that loop count to get a specific div id! -->
  21. <div class="popup_whitepaper">
  22. <div class="whitepaper_form">
  23. <!--
  24. I could put a <?php echo do_shortcode...> here, no?
  25. Their current solution is to grab a javascript code from an ACF field.
  26. I have had a lot of trouble figuring out how to put the CF7 form in that field.
  27. -->
  28. <?php the_sub_field('download_form'); ?>
  29. <div class="w-clearfix"></div>
  30. </div>
  31. <button data-fancybox-close="" class="fancybox-close-small"></button>
  32. <div class="w-clearfix"></div>
  33. </div>
  34. </div>
  35.  
  36. add_action( 'wp_footer', 'mycustom_wp_footer' );
  37.  
  38. function mycustom_wp_footer() {
  39. ?>
  40. <script type="text/javascript">
  41. document.addEventListener( 'wpcf7mailsent', function( event ) {
  42. if ( 'FORM ID' == event.detail.contactFormId ) {
  43. location = <!-- specific url derived from $lpcnt? -->;
  44. }
  45. }, false );
  46. </script>
  47. <?php
  48. }
Add Comment
Please, Sign In to add comment