Forums

A way (or plugin) to insert PHP, Javascript, etc into a WordPress post? (4 posts)

  1. ahrenba
    Member
    Posted 3 years ago #

    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?

  2. moshu
    Member
    Posted 3 years ago #

    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
    3. http://www.google.com/search?q=site:http://wordpress.org/extend/plugins/%20embed+video

  3. NC@WP
    Member
    Posted 3 years ago #

    ahrenba,

    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...

  4. hernanvionnet
    Member
    Posted 2 years ago #

    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>

Topic Closed

This topic has been closed to new replies.

About this Topic