Viewing 5 replies - 1 through 5 (of 5 total)
  • One of the solution for this is creating shortcode to display events tags and add it in footer using text widget.

    //Create shortcode 'event_tags'
    add_shortcode('event_tags','fun_display_event_tags');
    function fun_display_event_tags()
    {
            $separator =',';
    	//Check if current page is single event page
    	if(is_single() && get_post_type($id)=='tribe_events')
    	{
    		$id = get_the_ID();
    		echo $list      = get_the_term_list( $id, 'post_tag', '<dt> Tags </dt><dd class="tribe-event-tags">', $separator, '</dd>' );
    	}
    
           // If you want to display tags of all events then add following code
           $list = get_categories(
                           array(
    					'type'                     => 'tribe_events',
    					'orderby'                  => 'name',
    					'order'                    => 'ASC',
    					'taxonomy'                 => 'post_tag',
    
    				)
                    );
    		foreach($list as $tag)
    		{
    			echo $tag->name;
    		}
    
    }
    Brook

    (@brook-tribe)

    Howdy gaffnere,

    Did WisdmLabs awesome solution/code work? If a shortcode isn’t ideal, you could still easily adapt that code into a widget or just directly add the PHP where you need it.

    Cheers!
    – Brook

    Thread Starter gaffnere

    (@gaffnere)

    Thanks so much for the code, WisdmLabs! I really appreciate it!
    I am afraid I have never created a shortcode before though so not quite sure what to do now…

    Thanks for the suggestion of simply lobbing the PHP into my site in the footer, Brook. If I were to do it this way, what from the above do I need to include?

    Many thanks again for your help guys ??

    Thread Starter gaffnere

    (@gaffnere)

    Hi again, WisdmLabs, Brook,

    Thanks so much for the above code. I am very excited to try it.

    Ridiculous question but – WisdmLabs, can you please clarify where I should add that code? I have tried adding it to my functions.php file, with the following code just above it:

    add_filter( 'widget_text', 'shortcode_unautop' );
    add_filter( 'widget_text', 'do_shortcode' );

    I then added [event_tags] to a text widget in my footer.

    Was this incorrect? Because it isn’t working for me.

    Thanks again!

    g

    EDIT:

    I have realised that WordPress’ Tag Cloud widget will in fact do this trick for me… Just needs one alteration:

    I have set the Tag Cloud taxonomy to “Tags”. When a user clicks on a tag in the footer, however, only upcoming events with this tag will be shown…

    How do I get it to show all events with this tag – upcoming and past?

    Thanks!

    When a user clicks on a tag in the footer, however, only upcoming events with this tag will be shown…

    How do I get it to show all events with this tag – upcoming and past?

    Hey @gaffnere,

    To get an events list to display both “Past” an “Upcoming” events, your best bet is to use the tribe_get_events() function. You can learn more about this function here → https://theeventscalendar.com/knowledgebase/using-tribe_get_events/

    Cheers!
    George

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How can I display my event tags?’ is closed to new replies.