Adding a logo in the footer credits

⚠️ Code snippets might not be compatible with the latest version of your theme. Always use a child theme to customize your theme, and test your code on a staging website before migrating to production.

Notice for  Customiz-Pro (<1.2.5) users:
In order to use this code you have to uncheck Enable the footer copyrights and credits
under: Appearance -> Customize -> Footer -> Footer Credits

The following is a code snippet to add your logo in the footer. It will displays your logo only  if you have uploaded one, otherwise it will keep the actual credits in your footer.

Copy this code in your functions.php file :

add_filter( 'tc_credits_display', 'my_credits_display' );
function my_credits_display($html) {
  $logo_src    			= esc_attr ( tc__f( '__get_option' , 'tc_logo_upload') ) ;
  if ( empty($logo_src) )
    return $html;
  if ( is_numeric($logo_src) ) {
    $_attachment_data = wp_get_attachment_image_src( $logo_src , 'large' );
    $logo_src = $_attachment_data[0];
  } 
  ?>
  <div class="span4 credits">
   <?php
     $credits =  sprintf( '<p> · © %1$s <a href="%2$s" title="%3$s" rel="bookmark">%4$s</a> · Designed by %5$s ·</p>',
         esc_attr( date( 'Y' ) ),
         esc_url( home_url() ),
         esc_attr(get_bloginfo()),
         '<img src="'.$logo_src.'" alt="'.esc_attr(get_bloginfo()).'">',
         '<a href="'.TC_WEBSITE.'">Press Customizr</a>'
     );
     echo $credits;
   ?>
  </div>
  <?php
}

 

Leave a comment

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

6 thoughts on “Adding a logo in the footer credits”