I’m using a CIVICRM Form block (type create) to provide a form to the users to subscribe to a newsletter. I want to have this block on the frontpage of my wordpress site. I use the twentyseventeen Theme, which includes other pages on the frontpage as "hovering" blocks. I'm using the "Blocks for CiviCRM" Plugin to add the Form to the page. But using the "[]" Syntax makes no difference. I've tried several options to get the form to display:

[civicrm component="profile" mode="live" hijack="0" gid="14"]
[civicrm component="profile" mode="live" hijack="1" gid="14"]

I now created a page with just the CiviCRM block in it. When I just display this page, the form is displayed. However when the page is included as a block on the frontpage, nothing is displayed, the civicrm-div is just empty.

I think that I’m missunderstanding something about how the civicrm integration in wordpress is working, but I can’t find out what… Can you help me?

Screenshot of the page in the editor: Page in Editor

screenshot of the single page view Form in single Page view

emtpy block on the frontpage empty block on the frontpage

Thank you for your help!

  • Can you confirm which block plugin you are using? I use this one lab.civicrm.org/extensions/civicrm-gutenberg-blocks Can you also tell me what other content is on the front page? If the block works on a single but not the home/front page it maty be a conflict with other conten, perhaps an other CiviCRM form? Jan 9 at 22:09
  • I was using wordpress.org/plugins/blocks-for-civicrm, I've tried the one you mentioned, but that does not work in the editor at the moment.
    – Flavio C
    Jan 10 at 12:37
  • But I also doubt, that it's the plugin, because just using the shortcode behaves in the same way. So the main page is a single page with five pages that are included on the front page as hovering layers through the twenty-seventeen "section" option. I'm guessing that the problem is there - maybe the shortcode doesn't get properly interpreted when the page is included as a section as opposed to single page view?
    – Flavio C
    Jan 10 at 12:43
  • It would be good to know why the plugin I mentioned does not work. We use on many sites. If the shortcode behaves the same way there is another issue like a plugin conflict or other content on the home page. Can you detail what is on the home page in addition to this CiviCRM content? Jan 11 at 13:03
  • Hi Kevin There's a problem in the editor. As soon as I click the dropdown to select another profile, the plugin crashes. I tried looking through the issues on the github of the plugin, but there seems to be some kind of navigation bar overlay that blocks most of the page...
    – Flavio C
    Jan 11 at 20:56

2 Answers 2


The TwentySeventeen theme's "Homepage Sections" functionality isn't implemented using the WordPress Loop so attempts to invoke CiviCRM are caught by this code which is intended to prevent "double-invoke" situations caused by content-preprocessing plugins e.g. when JetPack & Yoast try to create OpenGraph previews etc. This is vital because invoking CiviCRM more than once will cause a fatal error.

Unfortunately, there don't appear to be any appropriate hooks in the TwentySeventeen theme whereby you might be able to trick CiviCRM into rendering during the Sections pseudo-loop.

If you're using ACF Pro, what you could do is create the form using ACF Extended and CiviCRM Profile Sync. Alternatively you could use Caldera Forms and the CiviCRM integration plugin.

Lastly, perhaps there's a way to create the form using FormBuilder and embed it with the CiviCRM Shortcode? The [civicrm component="afform"] Shortcode doesn't invoke CiviCRM so won't be subject to the same limitations and should render as expected.

  • Thank you very much for your help - that makes sense, and I suspected something "deeper-down" in the wordpress/civicrm integration. At least I now understand why. Could I fake being "in_the_loop()" ?
    – Flavio C
    Jan 11 at 20:51

Thank to Christians comment, I was able to find a workaround:

I modified inc/template-tags.php of the twentyseventeen theme, and "faked" being in the loop. Based on Christians description I do not expect any side-effects, as it's only used on the front-page.

    global $wp_query; // we need the global wp_query to fake being in the loop
    if ( get_theme_mod( 'panel_' . $id ) ) {
        $wp_query->in_the_loop = true; // fake the loop for CiviCRM to work correctly
        $post = get_post( get_theme_mod( 'panel_' . $id ) );

This way, the civicrm shortcode get properly executed. Thank you.

  • Rather than modifying the parent theme, use a child theme and supply the modified file there. Otherwise your changes will be overwritten when TwentySeventeen gets updated. Jan 11 at 22:59
  • Hmm, actually that's not possible since the function isn't wrapped in function_exists(). I'd open a ticket and supply a patch to the theme with do_action() calls before and after the relevant code - that way you could fake the loop via the action and revert afterwards. Jan 11 at 23:05
  • Either the above, or wrap the function in function_exists() :) Jan 11 at 23:07
  • Last (and best) suggestion: use the parent_theme_file_path filter to supply your own copy of the inc/template-tags.php file. Better than having your code overwritten :) See: developer.wordpress.org/reference/hooks/parent_theme_file_path Jan 11 at 23:14
  • thank you for all your help, it's working now.
    – Flavio C
    Jan 13 at 20:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.