JM112
JM112

Reputation: 3

Wordpress get_footer() is calling default footer, not the one I call

I'm a bit new to this, but I researched this topic a bit online and can't seem to figure out what I'm doing wrong. So basically, I created a duplicate footer to call for the homepage. We use a marketing automation tool called Pardot and we don't want to track visits to the homepage. So I created a file in the footer folder next to "footer-default.php" called "footer-nopardot.php" that omits the code.

In the home.php file, I edit the bottom with

<?php

get_footer('nopardot'); ?>

But it appears the homepage is still calling the default footer. Any advice on what to do or what I'm doing wrong?

Thanks!

Upvotes: 0

Views: 1206

Answers (3)

Manindra Singh
Manindra Singh

Reputation: 769

just add this to your home template:

<?php
    if ( is_home() ) :
        get_footer( 'nopardot' );
    else :
        get_footer();
    endif;
    ?>

Upvotes: 2

Montiyago
Montiyago

Reputation: 647

you can use this loop just replace the home or 404 by your page name where you want to display your footer:

<?php
if ( is_home() ) :
    get_footer( 'home' );
elseif ( is_404() ) :
    get_footer( '404' );
else :
    get_footer();
endif;
?>

and since you are just changing your home page footer u can just do this

<?php
    if ( is_home() ) :
        get_footer( 'yourName' );
    else :
        get_footer();
    endif;
    ?>

Upvotes: 2

Anas
Anas

Reputation: 616

Make sure of the file name to be footer-yourName.php and then call it as follow:

get_footer( 'yourName' );

hope that helps :)

Upvotes: 1

Related Questions