首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用我自己的函数替换wp_get_attachment_image

用我自己的函数替换wp_get_attachment_image
EN

WordPress Development用户
提问于 2013-06-06 12:55:10
回答 1查看 6.7K关注 0票数 4

如何在不更改核心文件的情况下替换wp_get_attachment_image()函数。该函数没有动作钩子或过滤器钩子。

我想要达到的目标:

对于lazyload插件输出,图像html如下所示:

代码语言:javascript
复制
<img width="150" height="150" data-src="http://localhost/yxz/wp-content/uploads/2010/06/calliope.slide_-150x150.jpg" class="attachment-thumbnail" alt="calliope.slide" src="http://localhost/yxz/wp-content/uploads/blank.png">

而不是这样:

代码语言:javascript
复制
<img width="150" height="150" src="http://localhost/yxz/wp-content/uploads/2010/06/calliope.slide_-150x150.jpg" class="attachment-thumbnail" alt="calliope.slide">
EN

回答 1

WordPress Development用户

发布于 2013-06-06 13:04:19

您可以在functions.php文件中创建另一个函数,然后使用它而不是wp_get_attachment_image()

票数 0
EN
页面原文内容由WordPress Development提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://wordpress.stackexchange.com/questions/102079

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档