How to get image url of img tag in wordpress

2019-07-04 06:53发布

I'm creating a wordpress theme. and i want some of the images to remain static. how can i get the url behind my image source.

My Default Image URL <img src="assets/logo/logo.jpg">

I was trying <img src="../assets/logo/logo.jpg">

Is there any function of wordpress that we can use to get the url of an image?

1条回答
做自己的国王
2楼-- · 2019-07-04 07:20

You need to get the full path of the theme folder too you can do it like this

<img src="<?php echo get_stylesheet_directory_uri(); ?>/assets/logo/logo.jpg">
查看更多
登录 后发表回答