Skip to content

Instantly share code, notes, and snippets.

@damiencarbery
Last active April 30, 2018 10:49
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 damiencarbery/04b596c673a3135627b0512ab3751893 to your computer and use it in GitHub Desktop.
Save damiencarbery/04b596c673a3135627b0512ab3751893 to your computer and use it in GitHub Desktop.
<?php
/*
Plugin Name: Ninja Forms - Set options in select field.
Plugin URI: https://www.damiencarbery.com/2018/04/product-enquiry-form-for-variable-woocommerce-products/
Description: Set the options in a specific select field in Ninja Forms.
Author: Damien Carbery
Version: 0.1
*/
add_filter( 'ninja_forms_render_options', function($options,$settings){
if ( 'select_product_attributes' == $settings[ 'key' ] ) {
$options = array();
$options[] = array(
'label' => "A label",
'value' => 'a'
);
$options[] = array(
'label' => "B label",
'value' => 'b'
);
$options[] = array(
'label' => "C label",
'value' => 'c'
);
}
return $options;
},10,2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment