wyc
wyc

Reputation: 55283

Can't source image from Wordpress (and Starkers Theme) index.php file?

I'm trying to put an image (logo.png which is in the very same folder as index.php) in index.php (line 23):

<?php
/**
 * The main template file.
 *
 * This is the most generic template file in a WordPress theme
 * and one of the two required files for a theme (the other being style.css).
 * It is used to display a page when nothing more specific matches a query.
 * E.g., it puts together the home page when no home.php file exists.
 * Learn more: http://codex.wordpress.org/Template_Hierarchy
 *
 * @package WordPress
 * @subpackage Starkers
 * @since Starkers 3.0
 */
//$body ="home";
get_header();
//include_once 'localization.php';
?>
<div id="content">
    <div class="container">
        <div id="header-bottom">
            <div id="slider">
                <img src="logo.png"/>
            </div>
            <div id="tagline">
                <p>This a testThis a testThis a testThis a testThis a testThis a test</p>
                <p>This a testThis a testThis a testThis a testThis a testThis a test</p>
            </div>
        </div><!-- header-bottom -->
        <div id="mainbar">
            <?php
            /* Run the loop to output the posts.
             * If you want to overload this in a child theme then include a file
             * called loop-index.php and that will be used instead.
             */
             get_template_part( 'loop', 'index' );
            ?>
            <p><?php echo $test; ?></p>
        </div>
        <?php get_sidebar(); ?>
    </div><!-- .container -->
</div><!-- #main-content -->
<?php get_footer(); ?>

it doesn't matter if I put logo.png in the same folder as index.php the image doesn't appear

Webkit development tools says:

Resource interpreted as image but transferred with MIME type text/html.

Don't know what it means

Any suggestions?

Upvotes: 1

Views: 1758

Answers (2)

wyc
wyc

Reputation: 55283

This made it work:

<img src="<?php bloginfo('template_directory'); ?>/images/featured.png"/>

I didn't know I had to include the template_directory.

Upvotes: 0

rrrfusco
rrrfusco

Reputation: 1119

What happens when you try:

<img src="http://www.site.com/logo.png"/>

Upvotes: 1

Related Questions