• Hi WordPress,

    The default twentyeleven theme function calls register_default_headers() using “%s” as a placeholder in the template directory.

    If I wanted to store my custom header images in my child theme, i would need to refer to the stylesheet directory. What would be the correct placeholder for the stylesheet directory?

    Thank you

Viewing 4 replies - 1 through 4 (of 4 total)
  • You shouldn’t need to do anything. The code in the parent will automatically look in the same folder in the child theme.

    Thread Starter Lulio Sr.

    (@lulio-sr)

    esmi,

    I’m sorry, but I don’t quite understand your answer.

    Let me rephrase my question. I’m not using twentyeleven as my parent theme. My parent theme doesn’t have support for custom headers. To make it simple, say I want to add the custom headers feature to my child theme by borrowing code from twentyten’s functions.php file:

    `// No CSS, just IMG call. The %s is a placeholder for the theme template directory URI.
    if ( ! defined( ‘HEADER_IMAGE’ ) )
    define( ‘HEADER_IMAGE’, ‘%s/images/headers/path.jpg’ );`

    My question is about the %s placeholder. It prints the template directory; meaning, the parent’s theme directory URI. Is there a placeholder that would print the child’s theme directory URI (Known in WordPress as the stylesheet directory) instead?

    Thanks for your help, Lulio

    If you are just adding this to the child theme, you don’t need %s. Just try using get_stylesheet_directory_uri.

    Thread Starter Lulio Sr.

    (@lulio-sr)

    esmi,

    In practice, that works fine.

    I was just curious about the existence of a placeholder for the stylesheet directory. I think the answer comes from wp-includes/themes.php. However, that would be “above my pay grade”; I’m a plain web designer.

    Thanks esmi.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Placeholder for the stylesheet directory’ is closed to new replies.