WordPress.org

Support

Support » How-To and Troubleshooting » php include not activating inside a post

php include not activating inside a post

  • Hi, I have some php includes in my post. I’m assuming because of the dom structure of loading the php codes wont trigger inside a post.
    So how can I do this?
    Maybe an on load event or java script, I’m clueless can someone help me?

    Basically I made a mini “template” to post in my posts, and compacted it into 10 php include files.
    That’s the jiff, so I await for some recommendations.

Viewing 3 replies - 1 through 3 (of 3 total)
  • For security reasons, WordPress chose to not allow php code in the text of Posts or Pages you create. The two common ways “around” this are:

    1. Plug-ins written by individuals (not the WordPress development team) specifically to allow php code in Posts or Pages
    2. Create your own Template file by modifying existing ones in your chosen Theme, typically single.php for Posts and page.php for Pages, either replacing the existing files or having custom ones that you have to select each time you create a post or page.

    The plug-in directory is here: http://wordpress.org/extend/plugins/

    The best place to start to read about Template files is here: http://codex.wordpress.org/Stepping_Into_Templates

    Personally, I choose a third approach: I used Custom Fields to store php, and inserted it in posts, pages and elsewhere using double square bracks around the Custom Field name. But that required me to change templates and write a function (in php) to look for double square brackets in the content of each post or page.

    Thank you guys.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘php include not activating inside a post’ is closed to new replies.
Skip to toolbar