#42 – Contact Form 7 Integration

Posted in ‘weeblrAMP’
This is a public ticket. Everybody will be able to see its contents. Only enter usernames, passwords or any other sensitive information in the Private information field.
Friday, 03 November 2017 20:21 UTC
steve.silenzio
 I'm trying to activate a contact form on my site, but I don't use the CF7 shortcode in the page editor, I have it setup in our theme. How do I use the wbamp-show start, etc shortcodes within my theme?
 
Friday, 03 November 2017 20:37 UTC
steve.silenzio
I should add that I have it in my theme using <?php echo do_shortcode('[cf7 code goes here]'); ?>.
 
Monday, 06 November 2017 08:54 UTC
wb_weeblrpress
Hi

When an AMP page is rendered, your theme is not used at all (because it outputs content that is not AMP compatible). So if you need to add some content, you basically simply have to apply the same customization you did on your theme to the AMP "theme".

This is essentially described in this part of the documentation.

Either you can use a hook, or instead a template override. Depending on where and when you want your CF7 form to appear, we can identify which file needs to be modified (ie the CF7 code be inserted). Once you know which file needs to be modified, you copy the original to your child theme, in the proper directory (I assume you are doing your theme changes inside of a child theme?), apply your change, and this should then appear on the AMP version.

I would suggest you list your site URL in the "Private information" section below, that might help understand where your for should be added.

RGds

 
Monday, 06 November 2017 14:37 UTC
steve.silenzio
I'm attempting to use the theme overrides, but now I get this {weeblramp_protected_3d8235201df11c429248e1ca3ac4e50c} instead of my contact form. Also it is not a child theme, but this is a custom theme I've built.

I've added the URL below so you can see what I am seeing. I'm trying to have this contact form appear on every page, as it would on our normal site.
 
Monday, 06 November 2017 14:40 UTC
steve.silenzio
 
Monday, 06 November 2017 14:56 UTC
wb_weeblrpress
Hi

ok, this would happen because of the special processing we have to apply to forms. The content in overrides is supposed to be AMP-compatible, but form are a special case.
I will reproduce this on a local setup to investigate, can you share how you did it exactly? just created an override and inserted do_shortcode in it?

In the meantime, I would suggest another way, which might actually be simpler:

- go to WP Appearance menu
- drag and drop a "Custom HTML" widget onto the "AMP: after content" widget position
- in the widget, enter the shortcode as in:

[contact-form-7 id="678" title="Contact form"]



Rgds
 
Monday, 06 November 2017 15:02 UTC
wb_weeblrpress
Hi again,

As a side note, I can see that on, for instance, https://www.xxxxxx.com/about/amp, Google Tag manager fails to load (see the browser console). A common reason for that is using the same GTM container ID as for the main site. Is it so? if yes, you must create a separate AMP container, and this GTM container must be of an AMP type (see: https://www.weeblrpress.com/documentation/products.weeblramp/1/going-further/analytics-tag/index.html#h2_google_tag_manager_settings).

Rgds
 
Monday, 06 November 2017 15:11 UTC
steve.silenzio
Yes, I've got weeblramp/layouts/weeblramp/frontend/amp/footer.php within my theme, and that file looks like this

<?php
/**
 * weeblrAMP - Accelerated Mobile Pages for Wordpress
 *
 * @author       weeblrPress
 * @copyright    (c) WeeblrPress - Weeblr,llc - 2017
 * @package      weeblrAMP
 * @license      http://www.gnu.org/copyleft/gpl.html GNU/GPL
 * @version      1.8.0.620
 *
 * 2017-09-20
 */

// no direct access
defined('WEEBLRAMP_EXEC') || die;

if (!$this->hasDisplayData('footer'))
{
	return;
}

?>
<footer class="wbamp-footer">
	<?php
    echo do_shortcode('[contact-form-7 id="300" title="Contact AMP"]');
    echo $this->get('footer');
  ?>
</footer>


That method of adding the form is not working either. Nothing is appearing. Do I need to regenerate the AMP pages with the plugin again?
Also, that container is an AMP container, not the one we use for the main site. That one is not published yet, there are no tags for it at the moment.
 
Monday, 06 November 2017 15:34 UTC
wb_weeblrpress
Hi

ok, the GTM thing was a just a passing remark, if you have.

I just reproduced your use case, and I have no problem showing a CF7 form using either the AMP widget method (which is simpler, and I should have suggested first), or the template override method.

When using the template overrides, the form shows using either:

 ?>
    <h3>In override</h3>

    [contact-form-7 id="xx" title="Contact AMP"]
    <?php

or
<?php
    echo do_shortcode('[contact-form-7 id="xx" title="Contact AMP"]');


I am trying to think about which weeblrAMP options could have an impact on that:

- Disable theme on AMP page must NOT be checked
- Let WP process content... should be set on"As usual, all filters and shortcodes"
- The CF7 integration must be enabled

Also, do you have a chance to try with another theme, temporarily or on a staging server?

Alternatively, can you provide temporary admin access so I can review weeblrAMP settings?

Rgds
 
Monday, 06 November 2017 16:43 UTC
steve.silenzio
All of those options are set as they should, and trying another theme on a staging server (WP default twentyfifteen) results in the same weeblramp_protected code showing.

I've added an admin account so you can check the settings.
 
Monday, 06 November 2017 16:55 UTC
wb_weeblrpress
Hi

The Widget method works, simply AMP widgets are disabled by default. This can be changed in the weeblrAMP customizer , for posts, pages, etc, under the "Content layout" tab.



I have to double-check notes on that, not sure why we disabled it by default...

As for the other method, I realized I did not modify the same file in my testing. You modified footer.php, but I instead modified single_item.php, which is the main template for a post/page. I will check that again, there might be a bug here, as things should work the same in the footer.

Rgds
 
Monday, 06 November 2017 17:07 UTC
wb_weeblrpress
Hi again,

Actually, AMP Widgets should be enabled by default. Can you confirm you disabled them?

Rgds
 
Monday, 06 November 2017 17:15 UTC
wb_weeblrpress
Hi

OK, go the last word on it: The 'footer' layout is meant to be customized from the admin:



Only the content entered in the admin is processed (ie shortcode executed, content converted to AMP, etc). If you override the template directly, you can only insert HTML there.

Best is:

1 - Use the AMP widgets
2 - If you need more complex customization, customize the 'single_item' layout, under 'weeblramp.frontend.amp.contents'.

Currently, I have left the site running with the widget, and I tested sending a message through the form

Rgds



 
Monday, 06 November 2017 18:34 UTC
steve.silenzio
I don't recall deactivating it, but it all looks good now. Thanks for the help!
 
Monday, 06 November 2017 18:37 UTC
wb_weeblrpress
Hi

You're welcome!

1 - If you did not deactivate them, is it possible that you installed the free version of weeblrAMP (from the WP repo) before getting the full version?

2 - I noticed while on your site an incorrect configuration check message: you are warned that you did not enter an Analytics ID, while you actually did. We have fixed the problem (the check only consider the Google Analytics ID, not the GTM id), and a fixed version is available on the development versions download area. Alternatively, just wait for next update.

Rgds
 
Monday, 06 November 2017 19:12 UTC
steve.silenzio
1 - I did install the free version to test the plugin and make sure everything worked before I bought it.

2. Fantastic, thanks!
 
Tuesday, 07 November 2017 09:08 UTC
wb_weeblrpress
Hi

I suspect this might cause this, as the AMP widgets are not available on the WP repo edition. I will investigate that...

Cheers
 
Wednesday, 22 November 2017 05:34 UTC
system
This ticket has been automatically closed. All tickets which have been inactive for a long time are automatically closed. If you believe that this ticket was closed in error, please contact us.
This ticket is closed, therefore read-only. You can no longer reply to it. If you need to provide more information, please open a new ticket and mention this ticket's number.