Shortcode to only apply to content on single-post-type page?
-
Hi everyone,
I’m using a shortcode like the following:
function my_content( $atts, $content = null ) { return '<div id="content">' . do_shortcode($content) . '</div>'; } add_shortcode('content', 'my_content');
My question is if it’s possible to only apply this shortcode to a specific template page? For example, single-book.php?
So the shortcode would only be used for the custom post type of book and it would not apply to all other areas of the site where the_content() is used.
Thanks!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Shortcode to only apply to content on single-post-type page?’ is closed to new replies.