WordPress.org

Ready to get started?Download WordPress

Forums

child theme prob with site logo (8 posts)

  1. tiki16
    Member
    Posted 3 years ago #

    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

  2. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

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

  3. money-maker
    Member
    Posted 3 years ago #

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

  4. tiki16
    Member
    Posted 3 years ago #

  5. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

    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(); ?>
  6. tiki16
    Member
    Posted 3 years ago #

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

  7. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

    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.

  8. tiki16
    Member
    Posted 3 years ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic