get_categories AND get customer taxonomy

I am using a plugin that creates its own taxonomy “itinerary”.

The theme I’m using has several different areas on the landing page.

Within the theme’s options (within the “Customize Theme” page) you can choose to display; All Categories, my_category1, my_category2 etc), however, it does not allow me to select my custom taxonomy, so I can’t display these “itineraries” on the home page.

The categories for the options are gathered from the below function.

function cryout_categories_for_customizer( $what = 0, $label_all = ”, $label_off = ”, $all = TRUE, $off = TRUE ) {
$categories = array(); $labels = array();
$cats = get_categories();
$categories = array();
$labels = array();
if ( count( $cats ) > 0 ):
if ($off) {
$categories[] = ‘-1’;
$labels[] = $label_off;
};
if ($all) {
$categories[] = ”;
$labels[] = $label_all;
};
foreach ($cats as $category) {
$categories[] = $category->category_nicename;
$labels[] = $category->name . ‘ (‘ . $category->category_count . ‘)’;
}
endif;
switch ($what) {
case 2: // labels only
return $labels;
break;
case 1: // cats only
return $categories;
break;
case 0: // both
default:
return array_combine($categories,$labels);
break;
}

I tried modding this but I’m real rusty on wordpress…I edited the above to include:

$categories = array(); $labels = array();
$args = array(
‘relation’ =–> ‘OR’,
array(
‘taxonomy’ => ‘category’,
),
array(
‘taxonomy’=> ‘itinerary’
),
);
$cats = get_categories($args);

Could I have the taxonomy name wrong? I’m taking this from a URL that shows all the itineraries i.e. www.myurl.com/itinerary/

Read more here:: get_categories AND get customer taxonomy

Leave a Reply

Your email address will not be published. Required fields are marked *