Skip to content

Instantly share code, notes, and snippets.

@kjohnson
Last active October 28, 2015 20:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kjohnson/59c4a009960b59a87f5c to your computer and use it in GitHub Desktop.
Save kjohnson/59c4a009960b59a87f5c to your computer and use it in GitHub Desktop.
<?php
/*
* Create a Form
*/
$form = Ninja_Forms()->form()->get();
$form->update_setting( 'title', 'Contact Me' );
$form->save();
/*
* Create a Form with an array of Settings
*/
$settings = array(
'title' => 'Contact Me'
);
$form = Ninja_Forms()->form()->get();
$form->update_settings( $settings )->save();
/*
* Update a Form
*/
$form = Ninja_Forms()->form( 1 )->get();
$form->update_setting( 'title', 'Contact Me' );
$form->save();
/*
* Update a Form with an array of Settings
*/
$settings = array(
'title' => 'Contact Me'
);
$form = Ninja_Forms()->form( 1 )->get();
$form->update_settings( $settings )->save();
/*
* Loop through Forms
*/
$forms = Ninja_Forms()->form()->get_forms();
foreach( $forms as $form ){
// Do Stuff Here
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment