Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
// Visual composer get terms on dropdown params
if( !function_exists('vcdd_get_terms') ){
function vcdd_get_terms( $taxonomy = 'category' ){
$get_categories = get_categories( array(
'taxonomy' => $taxonomy,
) );
foreach ( $get_categories as $category ) {
$categories[] = [ $category->term_id => $category->name ];
}
return $categories;
}
}
/**
* use vcdd_get_terms('taxonomy'); on visual composer addon vc_map() as dropdown value
* @return term id(s)
*/
/*
array(
'type' => 'dropdown',
'holder' => 'div',
'heading' => __('Select Cetegory', 'gasthof') ,
'param_name' => 'category',
'admin_label' => '',
'weight' => '',
'group' => __('General', 'gasthof') ,
'value' => vcdd_get_terms('ait-item-category') , //get values from 'ait-item-category' category
'std' => 'no',
) ,
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment