Plugin doesn't work with PHP called gravity_form() function
-
Noticed a little issue with this plugin.
I recently had to remove the gravity forms shortcode form a page and build a template which dynamically called the PHP gravity_form() function, inserting dynamic data using the function.
The plugin seems to check the post_content for the GF shortcode in function check_for_shortcode( $posts ), however, the GF PHP function doesn’t add the shortcode the the post_content, so the plugin never fires as the preg_match_all returns nothing.
To recap, I have an empty page content in the WP editor but my page template calls the GF PHP function directly. e.g.
<div class="entry-content"> <?php the_content(); ?> <?php // Output the Gravity Form echo gravity_form( 5, $display_title = false, $display_description = false ); ?> <?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'twentytwelve' ), 'after' => '</div>' ) ); ?> </div><!-- .entry-content -->You may have to hook into one of the GF hooks. I believe the JavaScript gform_post_render() function would work nicely.
Perhaps you can enqueue it after the page loads on the “wp” action hook and check there?
Cheerz,
Wil.
The topic ‘Plugin doesn't work with PHP called gravity_form() function’ is closed to new replies.