WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] bloginfo('template_directory'); only works in header.php (4 posts)

  1. Orabidoo
    Member
    Posted 4 years ago #

    Hi everyone,

    I'm using <?php bloginfo('template_directory'); ?> to link to images in my theme folder. It works in header.php, the logo is there and all is well...but in index.php the same code snippet doesn't return anything at all.

  2. Nile Flores
    Member
    Posted 4 years ago #

    Are you using this when you are publishing posts? It will not work there.

    It should work in your theme files only. Otherwise you will have to use the full link to images for your pages and widgets.

  3. Orabidoo
    Member
    Posted 4 years ago #

    But it's working in header.php, which becomes part of index.php...right?

    I guess I could use "wp-content/themes/theme_name/images" instead, since I know the name of the theme folder (I'm making this for a company, so no one else will use it).

  4. Orabidoo
    Member
    Posted 4 years ago #

    Something weird is going on. I uploaded the file again and now everything works! Maybe I uploaded the file to the wrong directory by accident? I dunno.

Topic Closed

This topic has been closed to new replies.

About this Topic