我正在尝试在 index.php中放置一张图像( logo.png 与 index.php 位于同一文件夹中)(第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(); ?>
如果我将logo.png放在与index.php相同的文件夹中并不显示图像
Webkit开发工具说:
Resource interpreted as image but transferred with MIME type text/html.
不知道这意味着什么
有什么建议吗?
答案 0 :(得分:1)
尝试时会发生什么:
<img src="http://www.site.com/logo.png"/>
答案 1 :(得分:0)
这使它起作用:
<img src="<?php bloginfo('template_directory'); ?>/images/featured.png"/>
我不知道我必须包含template_directory。