Skip to content

Instantly share code, notes, and snippets.

@tiborp
Last active October 4, 2017 14:37
Show Gist options
  • Save tiborp/a362823db63ca03dc030 to your computer and use it in GitHub Desktop.
Save tiborp/a362823db63ca03dc030 to your computer and use it in GitHub Desktop.
Conditional to check whether Gravity Forms shortcode is on a page
<?php
// conditional to check whether Gravity Forms shortcode is on a page
function lwd_has_gform() {
global $post;
$all_content = get_the_content();
if (strpos($all_content,'[gravityform') !== false) {
return true;
} else {
return false;
}
}
@povedica
Copy link

povedica commented Oct 4, 2017

Do you think another approach will be check if there is a gravityform JS enqueued or not? Just finding an approach I have come with yours. Thanks anyway

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment