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:
<?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?
You can wrap important things like this in a
class
. So declaring this vars as sooner as possible, maybe atinit
hook:will easily available in footer.php
Recommend tut: http://wp.tutsplus.com/tutorials/a-beginners-oop-class-framework/