WordPress: Add code to the theme footer

Do you want to add any code or HTML to the footer of your WordPress website without editing the theme file? You can easily add Google Analytics or other code in the WordPress footer by editing the functions.php file of the theme.

Paste the code below in the functions.php file and add your HTML or code in the space provided. It will be added to the WordPress footer using the wp_footer function.

<?php
add_action('wp_footer', 'footer_code');
 
function footer_code() { ?>
    // Paste your Google Analytics or other code here
<?php } ?>

Premium WordPress Themes

Reliable Web Hosting

Smart Web Worker strongly recommends HostGator for your website/blog hosting. Sign up for web hosting at just $3.96/month. Use the coupon code "SMARTBLOGGER25" to get 25% discount on any hosting packages. Get an account with HostGator now!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>