Skip to content

Instantly share code, notes, and snippets.

@akshuvo
Created June 26, 2018 21:50
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akshuvo/3bbfde2fd221d75d267438d4a94eb000 to your computer and use it in GitHub Desktop.
Save akshuvo/3bbfde2fd221d75d267438d4a94eb000 to your computer and use it in GitHub Desktop.
<?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