11/11/2014 at 9:29 pm
#309692
Keymaster
@ Steve
Maybe this will work for you.
Install the Code Snippets plugin.
Add a new snippet with the following code:
function cn_state_select() {
global $wpdb;
$sql = 'SELECT state FROM ' . CN_ENTRY_ADDRESS_TABLE . ' GROUP BY state';
$result = $wpdb->get_col( $sql );
$keys = array_map( 'urlencode', $result );
$values = array_map( 'esc_attr', $result );
$states = array_combine( $keys, $values );
cnHTML::select( array( 'id' => 'region', 'name' => 'cn-region', 'options' => $states, 'enhanced' => TRUE, 'default' => array( 'Select a State' ) ) );
}
add_action( 'cn_action_list_before-slim-plus', 'cn_state_select', 98 );
function cn_add_submit_button( $atts, $results ) {
cnTemplatePart::submit( array( 'return' => FALSE ) );
}
add_action( 'cn_action_list_before-slim-plus', 'cn_add_submit_button', 99, 2 );
function cn_disable_category_select( $atts ) {
$atts['enable_category_select'] = FALSE;
return $atts;
}
add_filter( 'cn_list_atts-slim-plus', 'cn_disable_category_select', 9 );
Save and activate the snippet.
-
This reply was modified 11 years, 9 months ago by
Steven Zahm. Reason: Fix link for Code Snippets
