agregoryvt
Member
Posted 2 years ago #
I have a theme that I customized for my site. When I try to run a shortcode in the page/post content nothing happens. It only shows it as text. But when I run the shortcode directly in the php code it works. Is there something I have to enable in my theme to be able to run shortcodes from the post/page content?
Make sure that you use <?php the_content();?> or <?php the_excerpt();?>
agregoryvt
Member
Posted 2 years ago #
Thanks for the help!
I created a separate function to get the content because the_content() doesn't return anything. Is there anything I need to do in my theme to enable the function?
agregoryvt
Member
Posted 2 years ago #
Nevermind I figured it out. It's because I wasn't in the loop correctly. Thanks again for your help!
the_content() includes some formatting and parsing filters. If you're grabbing raw, unfiltered, content, this will explain why your shortcodes aren't being parsed.