I am new to MAMP and I am developing a theme I designed. However I can’t seem to get the images to render. I am using a clear theme I got from starkerstheme.com
When adding an image directly to the code I used:
<img src="<?= $theme ?>/images/logo.png"/>
But the image is not showing up, also I tried to add it to the media library and it’s still not rendering.
This works for me:
See get bloginfo() function for more info.
You can use the following code to add an image. This works for me:
as suggested gets the PARENT theme, which is OK but if you’ve developed a child theme (as recommended by WordPress people) you need:
Just go to your dashboard and upload your picture in the media section, then select it you’ll see the image options .. then copy it’s url
<img src="your/copied/url"/>
This aslo works for me in localhost
You might need to do the full
<img src="<?php echo $theme; ?>/images/logo.png"/>
Update I didn’t read your question closely enough. If you’re using the media library for the image, you’ll need to specify the actual path to the image. You can figure this out from within the media library, but it’s probably
site_url/wp-content/uploads/2012/01/filename.jpg
In short, if you uploaded it in media, it wouldn’t actually be in your theme.
use for internal root folder in images to place on theme on wordpress.
The forward slash is needed for the image to show
Remove the
=
after<?
<img src="<? $theme ?>/images/logo.png"/>
in fact, I’d probably do something like this:
<img src= <?php $theme ?> . "/images/logo.png"/>
on 2021…
Just name the image as screenshot.png [ recommended image size (currently) is 1200px wide by 900px ] and put it on theme’s top-level directory (where the style.css file is )
and that’s all you need to do.