Support » Themes and Templates » child theme prob with site logo

  • Hi, working on my first child theme. In the child theme I have css and header.php and my images folder. I have changed the url to the logo in the header so that uses the one from my child theme. However when I view it, the image is broken and url path is to the parent theme?

    What am I doing wrong?
    thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • Chip Bennett

    (@chipbennett)

    Theme Review Admin

    You’ll need to post the relevant code in order for us to help you.

    You’ll probably do fine if you use a full URL path.

    Chip Bennett

    (@chipbennett)

    Theme Review Admin

    This is your problem:

    <?php echo get_template_directory_uri(); ?>

    You’re telling WordPress to look in the Template directory – i.e. your Parent Theme directory – for the logo.

    Change it to this instead:

    <?php echo get_stylesheet_directory_uri(); ?>

    How is this function call able to distinguish between parent and child theme? get_stylesheet_directory_uri()
    thanks for the help.

    Chip Bennett

    (@chipbennett)

    Theme Review Admin

    The stylesheet directory is the Child Theme. The stylesheet directory is the directory that holds the stylesheet for the currently active Theme. So, if you have a Child Theme active, get_stylesheet_dierctory_uri() will refer to the Child Theme.

    In the case of a Child/Parent relationship, get_template_directory_uri() will refer to the Parent Theme, based on the Template: parent-theme header tag included in the Child Theme’s style.css file.

    In the case of a stand-alone Theme, get_stylesheet_directory_uri() and get_template_directory_uri() will always refer to the same directory.

    Hi Chip, If I am using my own child theme css to override the parent style.css, how do i override styles from different directories within the parent theme? thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘child theme prob with site logo’ is closed to new replies.