I have a few lines of code in my footer.php file that I only want activated on the site’s home page. I have tried various suggestions for using is_front_page that I have found online, but none of them have worked. I am obviously not a php expert!
This is the site, and I am using a static page as the home page. Below is the code I’d like activated only on the home page. All help is appreciated!
<?php
$display_brands_widget = false;
if (isset($qode_options_flat['footer_brands_area'])){
if ($qode_options_flat['footer_brands_area'] == "yes") $display_brands_widget = true;
}
if($display_brands_widget): ?>
<div class="carousel_slider_holder clearfix">
<ul class="carousel_slider">
<?php dynamic_sidebar( 'brands' ); ?>
</ul>
</div>
<?php endif; ?>
Thanks to some great diagnostic help from @chris-rogers, I was able to figure out that is_front_page “wasn’t working” in footer content because I was using loading pages through Ajax. The simple solution ended up being to move the snippet of code in question to a new page template, so that it only loaded when that page content was called.
Have you tried using is_home()?