Skip to main content
Tweeted twitter.com/StackWordPress/status/1316076252546174977
better formatting
Source Link
Pieter Goosen
  • 55.4k
  • 23
  • 115
  • 209

I've been (almost) all over the internet to find a solution for this, but have yet to be os lucky.

I've defined a variable - let's call it $header_var$header_var, which is placed in the header.php file. I would like this variable to be passed onto my template file (in this case taxonomy.php).

Also I would like to be able to do the same the other way around, like passing a $template_var$template_var from my taxonomy.php to header.php. 

Is this even possible since the variable was not declared once the header was loaded?

I've tried using global $header_var$header_var but without luck.

Help anyoneAny suggestions?

I've been (almost) all over the internet to find a solution for this, but have yet to be os lucky.

I've defined a variable - let's call it $header_var, which is placed in the header.php file. I would like this variable to be passed onto my template file (in this case taxonomy.php).

Also I would like to be able to do the same the other way around, like passing a $template_var from my taxonomy.php to header.php. Is this even possible since the variable was not declared once the header was loaded?

I've tried using global $header_var but without luck.

Help anyone?

I've defined a variable - let's call it $header_var, which is placed in the header.php file. I would like this variable to be passed onto my template file (in this case taxonomy.php).

Also I would like to be able to do the same the other way around, like passing a $template_var from my taxonomy.php to header.php. 

Is this even possible since the variable was not declared once the header was loaded?

I've tried using global $header_var but without luck.

Any suggestions?

Source Link
user54079
  • 111
  • 1
  • 1
  • 3

Passing variables from header.php to template and vice verca

I've been (almost) all over the internet to find a solution for this, but have yet to be os lucky.

I've defined a variable - let's call it $header_var, which is placed in the header.php file. I would like this variable to be passed onto my template file (in this case taxonomy.php).

Also I would like to be able to do the same the other way around, like passing a $template_var from my taxonomy.php to header.php. Is this even possible since the variable was not declared once the header was loaded?

I've tried using global $header_var but without luck.

Help anyone?