user2162768
user2162768

Reputation: 69

how to include php in wordpress footer and call on pages

I am currently putting in php code in my wordpress footer. For example,

$a = "Hi";

and on my wordpress page i try to echo $a; but only get blank and not "Hi. Is there a way to solve this? P.s I am usuing WordPress's admin dashboard

Any help would be appreciated

Thanks

Upvotes: 0

Views: 112

Answers (1)

barakadam
barakadam

Reputation: 2249

Variables are not passed between template files (header, footer, etc.). You can make it global.

global $a;

And then echo it. Also note the order : if get_footer(); si called after, then you can't echo it before...

Upvotes: 2

Related Questions