The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › Back End › Code In WordPress
I’m trying to show code in WordPress posts with the <pre> tag. I’m including a script in my theme, but my only problem is having the html tags automatically converted to entities like < and >
Is there an automatic way to do this through the functions.php file?
Here’s what I’d do..
put this in your functions file:
and this goes after your opening pre tag:
and this before the closing pre tag:
the function will convert all of the brackets into the entities.
Since I’m using WordPress, using PHP within my posts wouldn’t be ideal. I need a way to do this automatically.
Edit: I’ve decided to deal with it and install the SyntaxHighlighter Evolved plugin instead of trying it myself.