bloginfo('template_directory') Isn't working. (2 posts)

  1. Andor Nagy
    Posted 3 years ago #

    Hey, I'm working on a theme for WP version 3.3 and I'm working with a theme options. And I want the user to be able to use custom logo. My code in the theme options for this is:

    $shortname = "nt";

    array( "name" => "Logo",
    	"desc" => "Custom Logo",
    	"id" => $shortname."_custom_logo",
    	"type" => "text",
    	"std" => "<?php bloginfo('template_directory'); ?>/images/green/logo.png"),

    And this is how I call it this way:

    <div id="header">
            <a href="<? bloginfo('url') ?>"><img src="<? echo get_option('nt_custom_logo'); ?>" /></a>

    But it doesn't works. It give me this:

    <div id="header">
            <a href="http://andorkh.com/lifeline"><img src="" /></a>

    Any idea or suggestions what could be the problem or what I'm making wrong?

  2. esmi
    Forum Moderator
    Posted 3 years ago #

    1. Don't use shortened PHP opening tags.
    2. Use get_template_directory_uri() or - even better - get_stylesheet_directory_uri
    3. what's the array for?

Topic Closed

This topic has been closed to new replies.

About this Topic