Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Adam Vesterager
Adam Vesterager
12,859 Points

Wordpress site logo from static to dynamic How do i make my logo in my static website dynamic?

I Have made the menu dynamic through codes, i need to make the logo dynamic to how is that possible?

<div id="top">
    <div id="logo">
        <a href="<?php bloginfo( 'url' ) ?>"><img src="images/logo.jpg" /></a>
     </div>
         <div id="nav_main">
             <?php 
                  $args = array(
                  'menu'        =>  'Header Menu', 
                  'menu-class'  =>  'nav navbar-nav', 
                   'container'   =>  'false'
                   );
                   wp_nav_menu( $args);
             ?>
         </div>
</div>

1 Answer

Joel Bardsley
Joel Bardsley
31,249 Points

If you're using WordPress version 4.5 or newer, you can use the Custom Logo API that was recently introduced. If you're creating a theme from scratch, you'll have to add theme support for the feature, which is explained here: How to Use the WordPress Custom Logo API with further information about the feature and the available parameters here: Custom Logo - Make WordPress Core

You can also refer to the code used in the twentyfifteen and twentysixteen themes. In twentysixteen, the theme support is located in functions.php, the function itself in /inc/template_tags.php and the template usage in header.php

Hope that helps.