Forum Replies Created

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

    (@tedullrich)

    Hi Ipsentu.

    No this is not a plugin issue. Infact, I just tested this on a completely separate install of WordPress with absolutely no plugins, and it does the same thing. Try it for yourself.

    It’s a bug.

    @Swamtyk, thank you for this tip, it worked for me!

    I have content that I want to show/hide in the footer and sidebar based on what page I’m on. Unfortunately, WordPress doesn’t allow you to use is_home() multiple times…

    So I setup a few global variables in the top of the index.php file, which will act as messengers to show/hide elements in the sidebar.php and footer.php files.

    At the top of my index file I have:
    <?php global $footer_display; ?>

    If I had multiple variables to declare, I would separate the variables with commas:
    <?php global $footer_display, $sidebar_display; ?>

    Then, when I query if the page is_home, I set the value to 1:
    <?php if (is_home) { ?>
    //blah blah
    <?php $footer_content = 1 ?>

    This variable is tested in the footer for a 1 value, and displays content accordingly…. so in essence, I’m able to turn things off and on throughout the site using the if statements I run in the index.

    HOWEVER, you must re-instantiate the global variable (not the value, just the variable) at the top of each separate file! So I also put this at the top of my footer file:
    <?php global $footer_display; ?>

    See here:
    http://bbpress.org/forums/topic/global-variables-in-header-not-passed-to-body

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