Title: custom shortcode in event description
Last modified: August 22, 2016

---

# custom shortcode in event description

 *  Resolved [dadadmin](https://wordpress.org/support/users/dadadmin/)
 * (@dadadmin)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/custom-shortcode-in-event-description/)
 * I have a custom shortcode I used on my site that outputs the content of a post
   in another page. That way if you have a page with the same content, you only 
   have to maintain the content in one area.
 * I want to use the shortcode within the description of my events, however nothing
   gets outputting on my event page. Is there a way to render my shortcode in the
   event details section?
 * This is the shortcode: [my_content id=”261″ /]
 * The number is the id of the post who’s contens I want to pull in.
 * This is the code in my functions.php file
 *     ```
       function get_post_page_content( $atts) {
       			extract( shortcode_atts( array(
       				'id' => null,
       				'title' => false,
       			), $atts ) );
   
       			$the_query = new WP_Query( 'page_id='.$id );
       			while ( $the_query->have_posts() ) {
       				$the_query->the_post();
       			        if($title == true){
       			        the_title();
       			        }
       			        the_content();
       			}
       			wp_reset_postdata();
   
       		}
       		add_shortcode( 'my_content', 'get_post_page_content' );
       ```
   
 * [https://wordpress.org/plugins/events-manager/](https://wordpress.org/plugins/events-manager/)

Viewing 1 replies (of 1 total)

 *  Plugin Support [angelo_nwl](https://wordpress.org/support/users/angelo_nwl/)
 * (@angelo_nwl)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/custom-shortcode-in-event-description/#post-5572895)
 * yes however haven’t tried this yet but maybe you can try to use do_shortcode 
   in the_content eg. [https://wordpress.org/support/topic/extract-shortcode-out-of-the_content?replies=3](https://wordpress.org/support/topic/extract-shortcode-out-of-the_content?replies=3)

Viewing 1 replies (of 1 total)

The topic ‘custom shortcode in event description’ is closed to new replies.

 * ![](https://ps.w.org/events-manager/assets/icon-256x256.png?rev=1039078)
 * [Events Manager - Calendar, Bookings, Tickets, and more!](https://wordpress.org/plugins/events-manager/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/events-manager/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/events-manager/)
 * [Active Topics](https://wordpress.org/support/plugin/events-manager/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/events-manager/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/events-manager/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [angelo_nwl](https://wordpress.org/support/users/angelo_nwl/)
 * Last activity: [11 years, 5 months ago](https://wordpress.org/support/topic/custom-shortcode-in-event-description/#post-5572895)
 * Status: resolved