从代码行中删除一个href
Remove a href from code line
我有一个wordpress主题,我想稍微编辑一下。在这个主题中,我想从我的html中删除一个包含图像的href
链接。BTF,我是编码新手,但主题支持没有回答。据我所知,它是用php和js生成的。
这是html
<a href="" class="thumb full_image" ind="0"><img src="http://www.example.com/wp-content/uploads/2015/08/DSC06676print-21x15.-900x1323.jpg" class="attachment-gallery-scroll" ind="0"></a>
这是生成html的代码行我想是的…
$html = sprintf( '<li class="fade" data-url-id="%s"><a %s href="%s" class="%s full_image" title="%s">%s</a></li>',$attachment_id, $rel, $image_link, $image_class, $image_caption, $image );
echo apply_filters( 'easy_image_gallery_html', $html, $rel, $image_link, $image_class, $image_caption, $image, $attachment_id, $post->ID );
最后,我想要像<img src="http://www.example.com/wp-content/uploads/2015/08/DSC06676print-21x15.-900x1323.jpg" class="attachment-gallery-scroll" ind="0">
这样的img line没有href,或者img line在前面,href在后面。
任何想法?这可能吗?我会为每一个答案感到高兴,这将使我更接近解决方案。谢谢! !
你现在看到的是:
$html = sprintf( '<li class="fade" data-url-id="%s">
<a %s href="%s" class="%s full_image" title="%s">%s</a></li>',
$attachment_id, $rel, $image_link, $image_class, $image_caption, $image );
这是你所需要的,基于你所描述的:
$html = sprintf( '<li class="fade" data-url-id="%s">%s</li>',
$attachment_id, $image);
[EDIT]在sprintf
被$html
调用后,有echo
的apply_filters
函数,我不知道确切的角色,因为它隐藏在你没有显示的其余代码中。在进行重大更改之前,值得考虑它的输出内容!
相关文章:
- CSS 在悬停时使图像变暗 - 在其周围添加一个 href
- 使用 Javascript 在运行时禁用<一个 href>
- 如何从一个 HREF 填充多个输入字段
- 将现有单选按钮更改为 <一个 href>
- 如何使用 JavaScript 单击一个 href 后编辑 3 个标签的值
- 返回值从 Javascript 到 HTML <一个 href> 标记
- 与号(&)在 DOM 中不转义会生成一个 href
- 使用php变量+javascript变量创建一个href-url
- <一个 href=#> 重定向到索引的链接..php
- 使文件输入成为一个href
- 带有javascript递增url的下一个/上一个href按钮
- 在 Echo 语句中插入一个 href
- 用jquery在一个href值的末尾添加
- 如何防止默认和禁用一个href
- 一个href click或onclick 2个动作(两个或更多函数)
- 如何循环遍历一个href's列表
- 如何通过jquery .html创建一个href,然后使用它的事件
- 向javascript代码中添加一个href类
- 选择一个href="#"打开父母李
- 如何使一个链接记住它的价值作为一个href之前转移到下一页中使用