Unable to use do_shortcode from Template File
I want to include an email signup form in the footer of my website using CiviCRM profiles. We are currently using a MailChimp signup form in the footer, so I think this is a reasonable thing to do.
I tried adding [civicrm component="profile" gid="14" mode="create" hijack="0"] to my theme's footer template, but the shortcode did not get resolved.
I tried adding <?php echo do_shortcode('[civicrm component="profile" gid="14" mode="create" hijack="0"]'); ?> to my theme's footer template, but that did not work either.
Upon looking at the code, do_shortcode calls render_single($atts) in /includes/civicrm_shortcodes.php which calls invoke() in /civicrm.php which gives up if $this->is_page_request() && !in_the_loop() && !is_admin().
In order for do_shortcode to work at the point in time when it's being called the logic in invoke has to be changed to allow the invoke to complete.
I created a fork (since I don't think I have the ability to create a pull request) which modifies those two files: https://lab.civicrm.org/mhlabriola/wordpress
I created a parameter for invoke which can be specified in render_single that will allow do_shortcode to return the requested profile form.