• Hi, I’m attempting to pass a variable from single.php to header.php.

    For example in single.php I have:
    <?php $wrapperstyle = "wide";?>

    I want to somehow pass this to the body_class as well.

    <body <?php body_class('$wrapperstyle'); ?>>

    Is this possible?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter simplethemes

    (@simplethemes)

    I believe I’ve found a solution to this but I’m curious if there is any performance issues for including header.php vs. using the get_header() function?

    <?php
    $wrapperstyle = "right";
    include(TEMPLATEPATH . '/header.php');
    ?>

    It might interfere with plug-ins which are called through the function get_header();
    (Example, CookieMonster, which I’m using)
    Don’t know about performance issues, should not be any IMO.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Passing variables to header.php’ is closed to new replies.