Support » Fixing WordPress » A way (or plugin) to insert PHP, Javascript, etc into a WordPress post?

  • ahrenba


    Hey Guys,

    I am sometimes able to insert Javascript into my WordPress posts, but it usually just ends up breaking and never works correctly.

    Is there a way to successfully add javascript or PHP code to a page. I am not talking about adding the code and actually showing it on the page, but let’s say I actually wanted the PHP or Javascript to run something (such as an embedded YouTube video)

    How can I do this?

Viewing 3 replies - 1 through 3 (of 3 total)
  • moshu


    You are asking 3 different questions: how to have PHP, JS and embedded video.
    The answers is yes, for all of them, although they all require a different solution.
    1. search for plugins like phpexe, execphp and similar keywords.
    2. Using_Javascript


    A little while ago, I actually wrote a simple plugin that allows you to include free-form PHP / HTML / JavaScript / whatever into WordPress posts/pages. You can download it here.

    Note, however, that if you use it to include PHP scripts, they will not be included in the PHP sense of the term; rather, the PHP script will run in its separate memory space, unrelated to WordPress, and its output will be embedded into the including post/page. So if you intend to include PHP scripts that rely on WordPress’ environment, data, or authentication, you will need to explicitly include() the proper WordPress files…

    Hi dudes.
    I’ve included the folowing php code with this plugin and it has worked OK!

    <p><strong>Projet Categorized as:</strong>
    <small><?php the_category('<br /></br>'); ?></small></p>
    <p><strong>Projet's Tags:</strong>
    <small><?php the_tags(''); ?></small></p>
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘A way (or plugin) to insert PHP, Javascript, etc into a WordPress post?’ is closed to new replies.