Created
June 26, 2018 21:50
-
-
Save akshuvo/3bbfde2fd221d75d267438d4a94eb000 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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