• Hi,

    I want to include JavaScript file using:

    <script type=”text/javascript” src=”file.js.php”></script>

    In this “file.js.php” I want to use _e function, but this doesn’t work.
    What do I have to do more to function _e I work in a given file?


    CT

Viewing 2 replies - 1 through 2 (of 2 total)
  • gwozdzmateusz

    (@gwozdzmateusz)

    Hi!

    So, if u want to attach .js file, all U need to do, is use
    <?php include("file.php"); ?>
    In this file start with
    <script type="text/javascript">
    and close the tag after Your javascript.

    Powodzenia ??

    Thread Starter ctomczyk

    (@ctomczyk)

    No, I don’t ask how to load JavaScript file with php extension. All I had to do is:

    define(‘ABSPATH’, ‘abs path to Your wp install’);
    require_once(ABSPATH.’wp-config.php’);
    require_once(ABSPATH.’url to Your JavaScript file’);

    And then You may use _e function.

    Regards,
    CT

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Include javascript file with extension php and using _e’ is closed to new replies.