Skip to content

Instantly share code, notes, and snippets.

@joshuadavidnelson
Created October 28, 2015 06:45
Show Gist options
  • Save joshuadavidnelson/49ebebbd454bc8714956 to your computer and use it in GitHub Desktop.
Save joshuadavidnelson/49ebebbd454bc8714956 to your computer and use it in GitHub Desktop.
Check if the page has a gravity form
<?php
/**
* Check if the page has a gravity form.
*
* @since 1.0.0
*
* @param int $id Post or page id, default to false.
*
* @return boolean
*/
if( !function_exists( 'has_gform' ) ) {
function has_gform( $id = false ) {
if( !$id ) global $post;
else $post = get_post( $id );
return isset( $post->post_content ) ? ( strpos( $post->post_content,'[gravityform' ) !== false ) : false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment