Last active
October 4, 2017 14:37
-
-
Save tiborp/a362823db63ca03dc030 to your computer and use it in GitHub Desktop.
Conditional to check whether Gravity Forms shortcode is on a page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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