Img Src正确,但仍然无法在index.php中工作 [英] Img Src correct, but still not working in index.php

查看:284
本文介绍了Img Src正确,但仍然无法在index.php中工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我相信我已经正确地在html中为我正在开发的(超基本)wordpress主题提供了一个图像;但它仍然无法显示。

I believe I've correctly sourced an image in html for a (super-basic) wordpress theme I am developing; however it still does not display.

此对话框:
本地计算机上的Img Src
显示到目前为止的过程(我已经确信html是正确的。)

This dialogue: Img Src on local computer shows the process so far (whereby I've been reassured the html is correct.)

index.php的主体:

body of index.php:

<?php
    $main_menu_column_top = array(
        'theme_location' => 'main-nav-column-top',
        'container' => 'nav',
        'container_class' => 'alignleft widecol',
        'container_id' => 'column-main-nav',
        'depth' => 1
    );
?>

<div class="leftcolumn">
    <div class="logo">
        <a href="http://www.petermaurin.com">
        <img src="images/pmsplogo.jpg" alt="Peter Maurin Screenprinters"/></a>
    </div><!--logo-->

    <div>
        <ul>
            <h1><?php wp_nav_menu ( $main_menu_column_top ); ?></h1>
        </ul>
    </div>
</div>

<div class="maincontent">

    <?php 
        if (have_posts()) :
            while (have_posts()) :
                the_post();
                the_title();
                the_content();
            endwhile;
        endif;
    ?>

    </div><!-- maincontent -->

functions.php:

functions.php:

<?php
register_nav_menus(
        array(
        'main-nav-column-top' => 'Main Nav, Top of Header',
        'sub-nav-column-bottom' => 'Sub Nav, Bottom of Header',
        'footer-nav' => 'Footer Menu'
    )
);

css:

* {
margin: 0;
padding: 0;
}

p {
font-family: Times New Roman;
}

body {
    font-size: 100%;
    font-family: sans-serif;
    background: url(images/tshirttexture.jpg) left repeat-y #0099ff;
}

.leftcolumn{
    width:365px;    
    float:left;
}

.maincontent{
    background-color:green;
    margin-left: 375px;
    max-width: 600px;
}

...如果有人可以看看,让我知道为什么我的形象(index.php第26行'pmsplogo.jpg'没有显示,我将非常感激!

... if anyone can take a look and let me know why my image ('pmsplogo.jpg' on line 26 of index.php) is not displaying, I'd be very grateful!

推荐答案

在img元素中,sr​​c属性应该如下所示

In the img element the src attribute should look like this

<?php bloginfo( 'template_url' );?>/images/pmsplogo.jpg

所以基本上完​​整的图片网址将是:

So basically the full image url will be:

<img src="<?php bloginfo( 'template_url' );?>/images/pmsplogo.jpg" alt="Peter Maurin Screenprinters"/>

这篇关于Img Src正确,但仍然无法在index.php中工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆