I’m building a CMS type site here and would like to make it so that if you view index.php (or home.php) then all the shortcodes are striped from the posts (the_content). When viewing another page like single.php then the shortcodes should be left along.
I think I need to use this code, but I’m not sure how:
<?php strip_shortcodes( $content ); ?>
This is the Codex page for it.
The reason for doing this is that my main page (home.php and index.php) get messed up when a Viper Video or Gallery shortcode get used, but obviously I want them to work when viewing them on single.php.
Thanks for the help!
- The topic ‘How to strip shortcodes if on index.php?’ is closed to new replies.