Unfortunately WordPress doesn’t generate an archive of taxonomy terms (a venue is a taxonomy term). You can create your own shortcode, or create a page template and use eo_get_venues()
.
I wouldn’t try to call the widget though, as that would involve initialising a ‘fake’ widget instance. But by all means copy out the code, a venue list can be as simple as using wp_list_categories()
.
This seems to work, but given my limited amount of coding with PHP this could very well use a code review. If nothing else, it’s a working sample 😉
I create the shortcode [eo_venues] which takes no parameters. It simply lists all the venues into a list sorted by name. It’s up to the user to create their own title for this list.
if ( ! function_exists( 'handle_venuelist_shortcode' ) ) {
function handle_venuelist_shortcode () {
$cat_args = array(
'orderby' => 'name',
'hierarchical' => false,
'taxonomy' => 'event-venue',
'id' => 'eo-event-venue'
);
ob_start();
echo '<ul>';
$cat_args['title_li'] = '';
wp_list_categories($cat_args);
echo '</ul>';
$list = ob_get_clean();
return $list;
} // End handle_venuelist_shortcode()
}
add_shortcode( 'eo_venues', 'handle_venuelist_shortcode' );