i want to show logo on navbar section.the logo appears but i cant control it with css.

        <?php wp_head(); ?>
<nav class="navbar navbar-expand-md navbar-light  sticky-top" style="background-color:rgb(3, 0, 180);" role="navigation">
  <div class="container" >
    <!-- Brand and toggle get grouped for better mobile display -->

    <a class="navbar-brand" href="#" > 
       <img src="<?php the_custom_logo(); ?>" height="42" width="42">


i typed notes on screen picture:

enter image description here


  • Why is wp_head() there? That function needs to be inside the <head> element. – Jacob Peattie Jul 3 '19 at 13:10
  • @jacob thank you for this info – Murat Deniz Jul 3 '19 at 13:25

The biggest issue you're running into is putting the_custom_logo() inside of an <img> tag. The function already outputs a full image tag, plus a link to the homepage wrapped around it. So, replace this

<a class="navbar-brand" href="#" > 
    <img src="<?php the_custom_logo(); ?>" height="42" width="42">

with this

<?php the_custom_logo(); ?>

to get rid of the first and third arrow in your screenshot.

  • so how can i size the logo? – Murat Deniz Jul 3 '19 at 13:25
  • Inspect it once it's output and figure out what CSS classes/elements/etc. you can target. – WebElaine Jul 3 '19 at 13:27
  • i am sorry bc i dont understand.can you explain with a example code? – Murat Deniz Jul 3 '19 at 13:29
  • The example code is above. First get that running. Then in your web browser, use your developer tools to inspect the element, and then you can find what classes, elements, etc. you need to use to target that specific logo. You may need to take some CSS classes if you're not familiar with that process. :) – WebElaine Jul 3 '19 at 13:36
  • can you look at my question again bc i changed class options but i dont know what is my mistake? – Murat Deniz Jul 3 '19 at 14:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.