ThemeShaper Forums » Thematic


Issue with child theme logo and permalinks

(7 posts)
  • Started 11 years ago by mandava
  • Latest reply from Buy Dog Treats
  • This topic is resolved
  1. mandava

    I just got into developing WP themes. I should also mention that my PHP skills are nowhere near 'strong'!

    I started developing a child theme, and I added a logo instead of the default text for the site title. I got the instructions from a topic on the forums here.

    It was working fine on my new default installation of WP 3 on my laptop. But when I uploaded the theme to my server, the logo shows up only on the home page due to permalinks being used on the server.

    On local machine, the css is
    <a href="http://localhost/new/"><img src="wp-content/themes/new/images/logo.png" alt="Logo" /></a>

    Any idea on how to resolve this issue?


    Posted 11 years ago #
  2. you can't use http://localhost on your live server, as that only applies to your home computer.

    also wp-content/themes/ is a relative (to whatever page you are currently on) link so it will pretty much never you have noticed.

    what i would do is define a constant for the theme

    define('CHILDTHEME_URI', get_stylesheet_directory_uri() . '/');

    and then change the link to:

    <a href="/"><img src="<?php echo CHILDTHEME_URI . 'images/logo.png' ; ?>" alt="Logo" /></a>

    you can use that constant anywhere you need to get a hyperlink to the theme folder as it will always produce something like

    i left the link to / which means site root (aka home), presuming that your install is in the root directory. i know that with XAMMP or MAMMP or whatever, htdocs is the root directory so you need to add the /new/ to get to the site, but this isn't the case on a live server.

    Posted 11 years ago #
  3. mandava

    Thanks for the reply.

    I'm sorry for asking, but how do you define a constant for the theme?


    Posted 11 years ago #
  4. you post the code i gave you into your child theme's functions.php

    define('CHILDTHEME_URI', get_stylesheet_directory_uri() . '/');

    basically you say define('constant name', 'constant value');

    Posted 11 years ago #
  5. mandava


    It worked.
    Thank you!

    Posted 11 years ago #
  6. cool. glad it helped.

    Posted 11 years ago #
  7. Excellent helping post regarding to download or upload children theme. But one think remained that you not told how can define constant for the theme.

    Posted 11 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.