如何在wordpress中获得img标签的图片网址 [英] How to get image url of img tag in wordpress

查看:80
本文介绍了如何在wordpress中获得img标签的图片网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个WordPress主题。我希望一些图像保持静态。

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.

我的默认图片URL
< img src =assets / logo / logo.jpg>

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

我试着< img src =../ assets / logo / logo.jpg>

有没有我们可以用来获取图片网址的wordpress功能?

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

推荐答案

您需要获取主题文件夹的完整路径,您可以像这样做

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">

这篇关于如何在wordpress中获得img标签的图片网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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