Support » Fixing WordPress » Adding PHP Variables from .php files.

  • I’m currently having issues on using variables from other php files, on my wordpress templates.

    Anyone know a solution that works or you’ve tried that works?

    Thank you very much 🙂

Viewing 1 replies (of 1 total)
  • I had a similar issue and founf the easiest way was to add an include statent in either the loop of in the particular template where you want the variables from another php file to work.

    For instance, I have a non WP script that displays photos from another php script.

    Let’s call the other script other.php

    I first created a template file by copying source code from my single.php file in my theme.

    Template Name: My_Modified_Template
    <?php include (TEMPLATEPATH . '/header.php'); ?>
    <?php include ('other.php'); ?>

    Of course the location of ‘other.php’ above is relevant to the root of the domain and my WP install is also in the root, so you’d need to change:

    <?php include ('other.php'); ?> to the location of your file so perhaps if your file is in /scripts then the include statement would be:

    <?php include ('/scripts/other.php'); ?>

    Perhpas this will work, depending on the type of outside php script you are running.


Viewing 1 replies (of 1 total)
  • The topic ‘Adding PHP Variables from .php files.’ is closed to new replies.