How to output a UL of items and URLS for custom taxonomy?
The plugin 'CPT UI' (Custom Post Type UI) is very good at creating custom post types. I have created a post type called 'Towns' that has a range of local towns assigned to it. (Also have 'Regions' and 'Experiences'.) I wish to create a shortcode that queries the custom post type and displays an unordered list to a page with the ability to add classes (like Shortcodes Ultimate).
This is the code the that CPT UI has generated to register a taxonomy in the functions.php file. How can this be modified to enable a shortcode to be used to display a list e.g. [cptui tax="town" class="town-list"]?
/**
* Taxonomy: Towns.
*/
$labels = [
"name" => esc_html__( "Towns", "custom-post-type-ui" ),
"singular_name" => esc_html__( "Town", "custom-post-type-ui" ),
];
$args = [
"label" => esc_html__( "Towns", "custom-post-type-ui" ),
"labels" => $labels,
"public" => true,
"publicly_queryable" => true,
"hierarchical" => false,
"show_ui" => true,
"show_in_menu" => true,
"show_in_nav_menus" => true,
"query_var" => true,
"rewrite" => [ 'slug' => 'town', 'with_front' => true, ],
"show_admin_column" => false,
"show_in_rest" => true,
"show_tagcloud" => false,
"rest_base" => "town",
"rest_controller_class" => "WP_REST_Terms_Controller",
"rest_namespace" => "wp/v2",
"show_in_quick_edit" => false,
"sort" => false,
"show_in_graphql" => false,
];
register_taxonomy( "town", [ "wpsl_stores" ], $args );
}
add_action( 'init', 'cptui_register_my_taxes_town' );```