Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter michaelhaene

    (@michaelhaene)

    Thanks a lot.
    This worked. First I thought I could just put it into the Form-CMS-Text field. But then I realized I needed to put it in a .php file (e.g. header.php).

    What the code does:
    1. Check, if I am on the form-page
    2. count together the entries of 2 databases (english & german)
    3. if it’s more than 250 entries, then I just hide the form-div and make a div called “ausverkauft” visible (includes a text like “sold out…”)

    My code looked then like this (in the header.php):

    <?php
    if (is_page(174) || is_page(5)) {
    ?>
    <script type='text/javascript'>
    jQuery(function() {
    var numEntries = <?php echo do_shortcode('[cfdb-count form="Kontaktformular de"]')?>+<?php echo do_shortcode('[cfdb-count form="Formular en"]')?>;
    	if (numEntries > 250) {
           $('.wpcf7').hide();
           $(".ausverkauft").appendTo(".entry-content");
           $('.ausverkauft').css( "display", "block" );
        }
        else {
           $('.wpcf7').show();
        }
    });
    </script>
    <?php
    }
    ?>
Viewing 1 replies (of 1 total)