Title: Event Description to allow HyperLink
Last modified: August 30, 2016

---

# Event Description to allow HyperLink

 *  Resolved [nnguyen](https://wordpress.org/support/users/nnguyen/)
 * (@nnguyen)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/event-description-to-allow-hyperlink/)
 * When listing event there are event descriptions beneath them.
    But should the
   event descriptions have a hyperlink, it is displayed as a regular text.([see image](http://s7.postimg.org/o5jrhwx7v/event_bug.png))
 * Here is the event post, notice it has a hyperlink for the word ‘here'([see image](http://s8.postimg.org/k3er1u7np/event_bug2.png))
 * Upon investigating, the tribe_events_get_the_excerpt function in general.php 
   seems to filter it out, i have tried to modified it but failed. In addition, 
   im not quite understanding the $allowed_html variable which does include hyperlinks.
   Any suggestions to allowing hyperlink to show up correctly in event descriptions?
 *     ```
       function tribe_events_get_the_excerpt( $post = null, $allowed_html = null ) {
       		// If post is not numeric or instance of WP_Post it defaults to the current Post ID
       		if ( ! is_numeric( $post ) && ! $post instanceof WP_Post ) {
       			$post = get_the_ID();
       		}
   
       		// If not a WP_Post we try to fetch it as one
       		if ( is_numeric( $post ) ) {
       			$post = WP_Post::get_instance( $post );
       		}
   
       		// Prevent Non usable $post instances
       		if ( ! $post instanceof WP_Post ) {
       			return null;
       		}
   
       		// Default Allowed HTML
       		if ( ! is_array( $allowed_html ) ) {
       			$base_attrs = array(
       				'class' => array(),
       				'id' => array(),
       				'style' => array(),
       			);
       			$allowed_html = array(
       				'a' => array(
       					'class' => array(),
       					'id' => array(),
       					'style' => array(),
       					'href' => array(),
       					'rel' => array(),
       					'target' => array(),
       				),
       				'p' => array(
       					'class' => array(),
       					'id' => array()
       				),
       				'b' => $base_attrs,
       				'strong' => $base_attrs,
       				'em' => $base_attrs,
       				'span' => $base_attrs,
       				'ul' => $base_attrs,
       				'li' => $base_attrs,
       				'ol' => $base_attrs,
       			);
       		}
   
       		/**
       		 * Allow developers to filter what are the allowed HTML on the Excerpt
       		 *
       		 * @var array Must be compatible to wp_kses structure
       		 *
       		 * @link https://codex.wordpress.org/Function_Reference/wp_kses
       		 */
       		$allowed_html = apply_filters( 'tribe_events_excerpt_allowed_html', $allowed_html, $post );
   
       		/**
       		 * Allow shortcodes to be Applied on the Excerpt or not
       		 *
       		 * @var bool
       		 */
       		 $allow_shortcode = apply_filters( 'tribe_events_excerpt_allow_shortcode', false );
   
       		// Get the Excerpt or content based on what is available
       		if ( has_excerpt( $post->ID ) ) {
       			$excerpt = $post->post_excerpt;
       		} else {
       			$excerpt = $post->post_content;
       		}
   
       		// Remove all shortcode Content before removing HTML
       		 if ( ! $allow_shortcode ) {
       			 $excerpt = preg_replace( '#\[.+\]#u', '', $excerpt );
       		 }
   
       		// Remove "all" HTML based on what is allowed
       		$excerpt = wp_kses( $excerpt, $allowed_html );
   
       		/**
       		 * Filter the number of words in an excerpt.
       		 *
       		 * @param int $number The number of words. Default 55.
       		 */
       		$excerpt_length = apply_filters( 'excerpt_length', 55 );
   
       		/**
       		 * Filter the string in the "more" link displayed after a trimmed excerpt.
       		 *
       		 * @param string $more_string The string shown within the more link.
       		 */
       		$excerpt_more = apply_filters( 'excerpt_more', ' [&hellip;]' );
   
       		// Now we actually trim it
       		$excerpt = wp_trim_words( $excerpt, $excerpt_length, $excerpt_more );
   
       		return wpautop( $excerpt );
       	}
       ```
   
 * [https://wordpress.org/plugins/the-events-calendar/](https://wordpress.org/plugins/the-events-calendar/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [nicosantos](https://wordpress.org/support/users/nicosantos/)
 * (@nicosantos)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/event-description-to-allow-hyperlink/#post-6879402)
 * Hi [@nnguyen](https://wordpress.org/support/users/nnguyen/),
 * You are right about this, but from what I could test this doesn’t relate to the_
   $allowed\_html_ variable. It seems like _wp\_trim\_words_ is return the text 
   without the html.
 * You can override the template (take a look at our [Themer’s guide](https://theeventscalendar.com/knowledgebase/themers-guide/))
   and change the code to use your own excerpt function or just regular WordPress
   _the\_excerpt_ function.
 * Please let us know about this,
    Best, Nico
 *  [nicosantos](https://wordpress.org/support/users/nicosantos/)
 * (@nicosantos)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/event-description-to-allow-hyperlink/#post-6879408)
 * PS: thanks for the report, I’ll mark this for review!
 *  Thread Starter [nnguyen](https://wordpress.org/support/users/nnguyen/)
 * (@nnguyen)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/event-description-to-allow-hyperlink/#post-6879409)
 * haha yea i figured that out too after half an hour of more researching. I ended
   up creating my own function that calls the_content function instead of your tribe_events_get_the_excerpt
   function. It worked out perfect.
 * Thank you for your time Nicosantos.
 *  Plugin Contributor [Brian](https://wordpress.org/support/users/brianjessee/)
 * (@brianjessee)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/event-description-to-allow-hyperlink/#post-6879456)
 * Great glad it helped you nnguyen.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Event Description to allow HyperLink’ is closed to new replies.

 * ![](https://ps.w.org/the-events-calendar/assets/icon-256x256.gif?rev=2516440)
 * [The Events Calendar](https://wordpress.org/plugins/the-events-calendar/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/the-events-calendar/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/the-events-calendar/)
 * [Active Topics](https://wordpress.org/support/plugin/the-events-calendar/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/the-events-calendar/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/the-events-calendar/reviews/)

## Tags

 * [descriptions](https://wordpress.org/support/topic-tag/descriptions/)
 * [hyperlink](https://wordpress.org/support/topic-tag/hyperlink/)
 * [link](https://wordpress.org/support/topic-tag/link/)

 * 4 replies
 * 3 participants
 * Last reply from: [Brian](https://wordpress.org/support/users/brianjessee/)
 * Last activity: [10 years, 5 months ago](https://wordpress.org/support/topic/event-description-to-allow-hyperlink/#post-6879456)
 * Status: resolved