Modify slider plugin’s get taxonomy to include custom taxonomy (years)

Question

The below code allows me to customize my sliders by category. I have a custom taxonomy called "years" that I would like to include. Ultimately, I want to be able to make sliders by category and by years.

if( !function_exists(‘plugin_get_taxonomies’) ){

function plugin_get_taxonomies( $plugin_texonomy = 'category' ){
    $terms = get_terms( array(
        'taxonomy' => $plugin_texonomy,
        'hide_empty' => true,
    ));
    $options = array();
    if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){
        foreach ( $terms as $term ) {
            $options[ $term->slug ] = $term->name;
        }
        return $options;
    }
}

}

0
Simon Li 3 months 0 Answers 12 views 0

Leave an answer