WordPress.org

Support

Support » Themes and Templates » [Resolved] Cannot Call a Variable defned in the Header

[Resolved] Cannot Call a Variable defned in the Header

  • Hi,

    I put this in the header.
    <?php $test = ‘test’; ?>

    And I put this in the sidebar,
    <?php echo $test; ?>

    But nothing happens. Why? Do I need to define a variable in every file?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Kafkaesqui

    @kafkaesqui

    In header:

    <?php global $test; $test = 'test'; ?>

    In sidebar:

    <?php global $test; echo $test; ?>

    Thank you so much, Kafkaesqui. I appreciate it.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Cannot Call a Variable defned in the Header’ is closed to new replies.
Skip to toolbar