Skip to content

Instantly share code, notes, and snippets.

@lukecav
Forked from stevehenty/gist:79364b0e2e029b995ef6
Last active May 2, 2018 03:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save lukecav/71a241f01d6b7a733e43f827ba8b986c to your computer and use it in GitHub Desktop.
Save lukecav/71a241f01d6b7a733e43f827ba8b986c to your computer and use it in GitHub Desktop.
Add Gravity Forms to the WordPress Dashboard
add_action( 'wp_dashboard_setup', 'wp_dashboard_setup' );
function sh_dashboard_setup() {
wp_add_dashboard_widget( 'wp_gf_dashboard', 'My Gravity Form', 'wp_gf_dashboard' );
}
function wp_gf_dashboard() {
// Make sure the scripts are loaded
// https://docs.gravityforms.com/gravity_form_enqueue_scripts/
gravity_form_enqueue_scripts( 2, true );
// Render the form
// https://docs.gravityforms.com/embedding-a-form/
gravity_form( 2, false, true, false, null, false );
// Or use the shortcode if you prefer
//echo do_shortcode( '[gravityform id=2]' );
}
@lukecav
Copy link
Author

lukecav commented Nov 8, 2017

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