Select Custom Taxonomy from Theme Options

Since you are likely developing this and you don’t have any posts associated with the season taxonomy, you will not get any terms returned with get_terms(‘season’);’ unless you specify the parameterhide_emptyto be0`. I would change the code thusly: /** Seasons */ $args = array( ‘hide_empty’ => ‘0’ ); $season_terms = get_terms(‘season’, $args); $season_tax = array(); … Read more

get_terms() – unexpected ‘=>’ (T_DOUBLE_ARROW) error

This is a PHP syntax error. You’re attempting to pass an array to get_terms() but haven’t used array() or [] to make it an array. This means that => is invalid here. The code should be: public function pggggo_list_of_terms() { $terms = get_terms( [ ‘taxonomy’ => [ ‘vehicle_safely_features’, ‘vehicle_exterior_features’, ‘vehicle_interior_features’, ‘vehicle_extras’, ], ] ); return … Read more

Get custom taxonomy value of post and output posts in same taxonomy

try with this function function get_posts_in_taxonomy($post_type, $taxonomy, $term_id, $include_children=false, $limit) { $args = [ ‘post_type’ => $post_type, ‘posts_per_page’ => $limit, ‘tax_query’ => [ [ ‘taxonomy’ => $taxonomy, ‘terms’ => $term_id, ‘include_children’ => $include_children ], ], // Rest of your arguments ]; $posts = new WP_Query( $args ); if($posts->have_posts()) { while($posts->have_posts()) { $posts->the_post(); //code todo here … Read more