07/28/2017 at 2:17 pm
#430630
Keymaster
@ Adam
You do not really add it to a template file, sort of… so it is somewhat difficult to explain…
I see you’ve purchased cMap sooo… you could add the code to the cmap.php file. I recommend using the Code Snippets plugin to add the drop down. This way adding the drop down is update safe.
You would hook into the cn_action_list_before-cmap action to render the drop down. Example:
add_action( 'cn_action_list_before-cmap', 'cn_add_gender_dropdown', 5 );
function cn_add_gender_dropdown() {
//echo you code for the drop drown
}
To make it functional you will also need to hook into the cn_list_retrieve_atts-cmap filter like so:
add_filter( 'cn_list_retrieve_atts-cmap', 'cn_gender_meta_query' );
function cn_gender_meta_query( $atts ) {
// NOTE: only set the meta query if the user has selected a gender
$atts['meta_query'] = array( 'meta_key'=> '{custom-field-id}', 'meta_value' => '{gender}');
return $atts;
}
