I attempted including my file in header.php or my theme's index.php, however i cannot access the variables within the incorporated file from let us say my theme's footer.php as well as my theme's page templates.

This is what I am including:

<?php

// some parameters
$var_research = 5;
$var_researchtrans = 7;
$var_output = 9;
$var_edit_indi = 11;
$var_contact = 15;
$var_transition = 19;

?>

Ok now what I want would be to have the ability to make use of the variables in footer.php, for instance.

Hope someone available comes with an answer. Thanks, y'all.

OK, here's the way i managed to get work:

In functions.php

<?php // functions.php

// ...

function my_var($va_var) {

    // some parameters
    $var_research = 5;
    $var_researchtrans = 7;
    $var_output = 9;
    $var_edit_indi = 11;
    $var_contact = 15;
    $var_transition = 19;
    $var_sometext = "text test";

    eval("\$return_var = $" . $va_var . ";");
    return $return_var;

}

?>

as well as in footer.php

<?php // footer.php

// ...

echo "blah blah " . my_var("var_sometext");

// ...

?>

It's working, but did I still do it? it is possible to better/right method of doing this? Many thanks, everybody.

I am unsure what your function does, however the spot to define functions is within your styles functions.php file.

Where to incorporate your personal functions have been in your theme's functions.php file.

If you wish to access a flexible in multiple files, you may create a function inside your functions.php and access that function anywhere inside the theme.

In functions.php

function your_variable()
{
    $var = 'your variable';
    return $var;
}

As well as in your footer.php

echo your_variable();

For the up-to-date query

function my_var($va_var) {

    $out = array();
    // some parameters
    $out['var_research'] = 5;
    $out['var_researchtrans'] = 7;
    $out['var_output'] = 9;
    $out['var_edit_indi'] = 11;
    $out['var_contact'] = 15;
    $out['var_transition'] = 19;
    $out['var_sometext'] = "text test";

    return $out[$va_var];

}

humm , the initial solution with this problem is you must save your valuable vars being an option variable in wordpress , something similar to this :

<?php add_option( $name, $value, $deprecated, $autoload ); ?>

and also the function :

<?php
function my_var($va_var) {
    add_option( 'var_research', '5', '', 'yes' );
}
?>

as well as in the footer.php you need to simply make use of this for retrieve your variable:

<?php _e(get_option('admin_email')); ?>

Best Of Luck