Title: Adding dynamic content to a plugin CPT
Last modified: August 24, 2016

---

# Adding dynamic content to a plugin CPT

 *  Resolved [webtent](https://wordpress.org/support/users/webtent/)
 * (@webtent)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/adding-dynamic-content-to-a-plugin-cpt/)
 * Not getting any replies to past posts, please let me know if I’m not posting 
   in the correct forum. I am a decent PHP programmer, but new to WordPress development.
   I did get my feet wet with one site we recently did and love the power of WP 
   shortcodes, however, I am not able to place shortcodes in the pages of a CPT 
   that I need dynamic content.
 * I need to add dynamic code to pages produced by a CPT created by a plugin. The
   code should only generate on the pages for this certain CPT. Depending on values
   of the CPT categories or custom fields, the code will either include a player
   in the page for playing an audio playlist or a form with one date field to post
   back to itself and download an audio file based on that date.
 * Could someone suggest the best approach for making this work?
 * Thanks, Robert

Viewing 1 replies (of 1 total)

 *  [Lucas Karpiuk](https://wordpress.org/support/users/karpstrucking/)
 * (@karpstrucking)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/adding-dynamic-content-to-a-plugin-cpt/#post-6104558)
 * Hi Robert,
 * I don’t think shortcodes are what you want to use here.
 * If I understand correctly, you want to dynamically add HTML to the page output
   to the single view of your custom post type, depending on the category and/or
   value of one or more custom post meta fields.
 * Depending on where you need the code to appear, you can use action hooks like`
   the_head`, `the_footer`, or `the_content`
 * In your action function you can check if the single view is in use with the `
   is_single()` function. You can get the post object of the current post with `
   global $post;` etc.

Viewing 1 replies (of 1 total)

The topic ‘Adding dynamic content to a plugin CPT’ is closed to new replies.

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 1 reply
 * 2 participants
 * Last reply from: [Lucas Karpiuk](https://wordpress.org/support/users/karpstrucking/)
 * Last activity: [11 years, 1 month ago](https://wordpress.org/support/topic/adding-dynamic-content-to-a-plugin-cpt/#post-6104558)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
