WordPress.org

Support

Support » Themes and Templates » Conditional Tags in footer.php

Conditional Tags in footer.php

  • Hi everyone,

    I want to implement the open source heatmap Clickheat on my blog. There’s a variable called ‘ClickHeatGroup’ in the javascript and I want to populate it with the current pagetype. So I used conditional tags in my footer.php. It doesn’t work. It’s ‘index’ on all pages.

    Any hints?

    Thanks in advance,

    Peter

    Here my code from the footer.php:

    <!-- Clickheat Clickmap Code -->
    
    <?php
      if(is_home())
        {
        $clickheatgroup = "index";
        }
      elseif(is_single())
        {
        $clickheatgroup = "article";
        }
      elseif(is_page())
        {
        $clickheatgroup = "page";
        }
      elseif(is_archive())
        {
        $clickheatgroup = "archive";
        }
      elseif(is_search())
        {
        $clickheatgroup = "search";
        }
      else
        {
          $clickheatgroup = "other";
        }
      ?>
    
    <script type="text/javascript" src="http://www.site.de/clickheat/js/clickheat.js"></script><noscript><p><a href="http://www.labsmedia.com/index.html">Marketing tools</a></p></noscript><script type="text/javascript"><!--
    clickHeatSite = 'seite.de';
    clickHeatGroup = '<?php echo $clickheatgroup; ?>';
    clickHeatServer = 'http://www.site.de/clickheat/click.php';initClickHeat(); //-->
    </script>
    
    <!-- Clickheat Ende Footerversion-->
Viewing 3 replies - 1 through 3 (of 3 total)
  • nexen –

    I tested the script on my own site, and it worked just fine. Do you have any kind of cache plug-in running on your site? If you do, try disabling the plug-in and testing again.

    ericmann –

    You’re right. The code is working. But in the theme I’m currently using it doesn’t work. I had WP-Cache, but deactivated it and I still have the same problem. That’s weird. But thank you for your feedback.

    The problem is that on every page in my theme, the conditional tags returns true for is_home() and is_front_page().

    It’s definetly a problem with this theme. Does anyone know what can influence conditional tags in the footer.php? In others themes the code work fine.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Conditional Tags in footer.php’ is closed to new replies.
Skip to toolbar