• Resolved robmcp

    (@robmcp)


    Hi. I’ve been using Easy Fancy box on several sites and it really is a useful plug in.
    To date most sites using it have only one form that pops up, some have two. Whilst trying to add a third I have come up against a problem. Despite creating a new separate form/id no, when the link is clicked, all that appears is a small white square with the active Close cross icon on the top right of that square.

    I did not produce the code originally and there are missing notes on this but could anyone say why you would not get the content of the form appearing?

    A working form link is coded thus:

    <p class="Enquiry"><a class="fancybox-inline" href="#contact_form_pop">CONTACT</a></p>
    
    <div class="fancybox-hidden" style="display: none;">
    <div id="contact_form_pop"><!--?php echo do_shortcode('[contact-form-7 id="124" title="Contact Form"]'); ?--></div>
    </div>

    Class=”enquiry” is just label fonts etc.

    The non working version is more or less identical:

    <p class="Enquiry"><a class="fancybox-inline" href="#second_enquiry_popup">Make an enquiry</a></p>
    
    <div class="fancybox-hidden" style="display: none;">
    <div id="second_enquiry_popup"><!--?php echo do_shortcode('[contact-form-7 id="560" title="Test form"]'); ?--></div>
    </div>

    As I am working blind (no original dev to ask) Some of the code can be resolved. The parts I am not sure of relate to the href item configuration. Should the #second_enquiry_popup be defined somewhere, or is it purely arbitrary?

    First point of investigation is to look for that href value for the working popup form, but it’s not in the child theme CSS I’ve also searched phpmyadmin and nothing is returned.

    Can anyone suggest a path to look down?
    Thanks.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi,

    The parts I am not sure of relate to the href item configuration. Should the #second_enquiry_popup be defined somewhere, or is it purely arbitrary?

    It’s completely up to you, as long as the link and the id correspond.

    The empty popup appearing would indicate the popup is working but it’s the content that is empty.

    Are you sure your contact form code looks like <!--?php echo do_shortcode('[contact-form-7 id="124" title="Contact Form"]'); ?--> because that is neither valid PHP nor HTML. Where are you using these snippets? In a template PHP file? If so, then it should look like <?php echo do_shortcode('[contact-form-7 id="124" title="Contact Form"]'); ?> (notice the start and finish). But if it’s used inside page or post or widget content, then it should look like [contact-form-7 id="124" title="Contact Form"] (just the shortcode).

    If you can share a link to your site, I can take a closer look ??

    Thread Starter robmcp

    (@robmcp)

    Thanks RavanH, sorry for the delay I’ve been off.
    I have several variations of the code for the button both the <–? and the plain<? versions work some are in template code and some are coded on a page in a div.

    The part I am stuck with is the href call the original developer wrote something like this

    <p class="StyleEnquiry"><a class="fancybox-inline" href="#contact_form_pop">Make an enquiry</a></p>
    
    <div class="fancybox-hidden" style="display: none;">
    <div id="contact_form_pop"><div id="contact_form_pop"><?php echo do_shortcode('[contact-form-7 id="1234" title="Contact Form"]'); ?></div></div>
    </div>

    The above code will work, even with <!–? in the front.

    If I copy the above code but replace the form ID number as below.

    <p class="StyleEnquiry"><a class="fancybox-inline" href="#new_form_pop">enquiry Special </a></p>
    
    <div class="fancybox-hidden" style="display: none;">
    <div id="new_form_pop"><?php echo do_shortcode('[contact-form-7 id="5678" title="Product Enquiry_copy"]'); ?></div>
    </div>

    When I click the first button, the form correctly appears. When I click the second button only the Cross and a tiny white square appear.

    If I add the short code to a page thus
    [contact-form-7 id="5678" title="Enquiry_copy"]

    Than what happens is the site crashes, in that no page content other than site header and menu appears. Very odd.

    The StyleEnquiry just styles form font and labels, what I am unsure of is how the href part is controlled / defined

    <a class="fancybox-inline" href="#contact_form_pop">Make an enquiry</a>
    The original dev does not appear to have created the href #contact_form_pop anywhere that I can find. Am I right in thinking this is just an arbitrary name, or will it be defined somewhere I have not found yet?
    And the other query Is why does inserting the shortcode crashes the content?

    Interesting puzzle… Happy to PM you a link to the test page if you wish?

    If I add the short code to a page thus
    [contact-form-7 id=”5678″ title=”Enquiry_copy”]

    Than what happens is the site crashes, in that no page content other than site header and menu appears. Very odd.

    Very odd indeed. What other plugins are running on your site?

    The original dev does not appear to have created the href #contact_form_pop anywhere that I can find. Am I right in thinking this is just an arbitrary name, or will it be defined somewhere I have not found yet?

    Yes, it is arbitrary.

    You can send me your site link via https://status301.net/contact-en/

    Thread Starter robmcp

    (@robmcp)

    Site link sent last night via the site.

    Yes, got it and responded by email.

    To resume in short: code with either <!--?php or even <?php inside WordPress posts/pages/widgets does nothing. That is why there is an empty popup. The working popup is filled with content from elsewhere on the page (above the menu), not from the div with the non-working code.

    Thread Starter robmcp

    (@robmcp)

    Hi,
    That is understood, sorry. Looking at it closer the code above the menu makes a plain enquiry form. However, if you select an individual product each one has a different – #custom enquiry popup call through easybox. That is what I an trying to do in adding the new one. You’ve helped though as I think there has to be a template php file somewhere that has that code in it, I just need to find it!
    Thanks for the help and your time.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Using Fancybox to open a Contact Form 7 form’ is closed to new replies.