Skip to content

Instantly share code, notes, and snippets.

@MatRouault
Last active April 24, 2016 10:23
Show Gist options
  • Select an option

  • Save MatRouault/cb449e67825a1cd994cce039266630b3 to your computer and use it in GitHub Desktop.

Select an option

Save MatRouault/cb449e67825a1cd994cce039266630b3 to your computer and use it in GitHub Desktop.
Beans - Adapt Ninja Forms for UiKit
<?php
// Do not include the opening php tag if it is already included in your file.
//* Note : A good practice is to load this snippet only if the plugin is activated.
//* Add this in your functions.php and the snippet in itself in a separate file.
// include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
// if( is_plugin_active( 'ninja-forms/ninja-forms.php' ) ) {
// include_once( get_stylesheet_directory() . '/lib/beans-ninja-forms.php' );
// }
// Completely Dequeue Plugin's CSS
remove_filter('ninja_forms_display_css','ninja_forms_display_css', 10, 2 );
// Add Ui-Kit Markup Before Form
function themeprefix_add_open_markup_ninja_form ( $form_id ) {
echo '<form class="uk-form"><fieldset data-uk-margin>';
}
add_action( 'ninja_forms_display_before_form_wrap', 'themeprefix_add_open_markup_ninja_form' );
// Add Ui-Kit Markup After Form
function themeprefix_add_close_markup_ninja_form ( $form_id ) {
echo '</fieldset></form>';
}
add_action( 'ninja_forms_display_after_form_wrap', 'themeprefix_add_close_markup_ninja_form' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment