Automator_Taxonomies::filter_taxonomies( $post_type,  $which )


Parameters Parameters

$post_type

(Required)

$which

(Required)


Source Source

File: src/core/automator-post-types/uo-taxonomies/class-automator-taxonomies.php

	public function filter_taxonomies( $post_type, $which ) {

		// Apply this only on a specific post type
		if ( 'uo-recipe' !== $post_type ) {
			return;
		}

		// A list of taxonomy slugs to filter by
		$taxonomies = array( 'recipe_category', 'recipe_tag' );

		foreach ( $taxonomies as $taxonomy_slug ) {

			// Display filter HTML
			wp_dropdown_categories( [
				'show_option_all' => get_taxonomy( $taxonomy_slug )->labels->all_items,
				'hierarchical'    => 1,
				'show_count'      => 0,
				'orderby'         => 'name',
				'name'            => $taxonomy_slug,
				'value_field'     => 'slug',
				'taxonomy'        => $taxonomy_slug,
				'hide_if_empty'   => true,
				'hide_empty'      => false,
			] );
		}

	}