简体   繁体   中英

Custom wordpress theme images not displaying

I'm building my first WP theme. My images are linked this way:

<img src="<?php bloginfo('wp-content/themes/SRPrint'); ?>images/freephone.png" />

Obviously theme folder called SRPrint and inside it there is an images folder.

Can't understand why images do not show up? I don't know any php so I asume problem is in php code? Images specified through style.css show up ok.

Please help.

Link to test site http://www.designstest.co.uk/

you must use <?php bloginfo('template_directory'); ?>/images/freephone.png <?php bloginfo('template_directory'); ?>/images/freephone.png to get the images in the current theme.

请参阅: bloginfo

<img src="<?php bloginfo('template_url'); ?>/images/logo.jpg" alt="<?php bloginfo('name'); ?>">

将所有图像更改为src=" <?php echo get_template_directory_uri();?> /images/picname.jpg"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM