• I need to list all the venues, with or without events, on a given page. Just like what the venue widge does, but on a page.

    Not sure that the eo_events short code has this option.

    Does this means I need write my own short code?

    Should I add my own short code that points at the venue widget’s function (or a variation of it)?

    https://wordpress.org/plugins/event-organiser/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Stephen Harris

    (@stephenharris)

    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().

    Thread Starter Jim Reekes

    (@reekes)

    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' );
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to list all venues’ is closed to new replies.