Declaring global variable php (wordpress)

In wordpress functions.php file I’ve following variable:

$MediSHOP_settings_db_theme = (get_option("MediSHOP_settings"));

But when I try to echo it inside footer.php nothing is displayed:

Read More
<?php echo $MediSHOP_settings_db_theme['shoptel']; ?>

Unless I declare it as global inside footer.php

Is there a way to make this variable persistent so I don’t have to declare this variable as global inside header.php, footer.php, and index.php and other template files?

Related posts

Leave a Reply

1 comment