Не можете получить изображение из файла Wordpress (и темы Старкера) index.php? - PullRequest
1 голос
/ 31 августа 2010

Я пытаюсь поместить изображение ( logo.png , которое находится в той же папке, что и index.php ) в 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.

Не знаю, что это значит

Есть предложения?

Ответы [ 2 ]

1 голос
/ 31 августа 2010

Что происходит при попытке:

<img src="http://www.site.com/logo.png"/>
0 голосов
/ 31 августа 2010

Это заставило его работать:

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

Я не знал, что мне нужно было включить каталог template_.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...