Img Src File path issue

No your file path setup is correct, you need to provide the absolute path in you img src for images to load on other pages as relative path would change to,

 http://yourwebsite.com/page/wp-content/themes/blankslate/images/morebutton.png 

and instead it should be

http://yourwebsite.com/wp-content/themes/blankslate/images/morebutton.png 

So you should define a constant in your function.php for path to image directory, and then use it in img src.

  if( !defined('THEME_IMG_PATH')){
   define( 'THEME_IMG_PATH', get_stylesheet_directory_uri() . '/images' );
  }

and then you can use img tag as

 <img src="<?php echo THEME_IMG_PATH; ?>/morebutton.png" alt=""/>

That would solve your issue. You can use the constant anywhere in your theme, handy to use.

Leave a Comment