首页 文章

Wordpress图像从网址中删除宽度参数并删除高度宽度标记

提问于
浏览
0

我已经将少量图像上传到wordpress,滑块中的图像仅包含550px . 虽然我的原始图像宽度是1024px .

所以wordpress正在使网址像这样:

img class = "amazingslider-img-elem-3" data-originalwidth="550" data-originalheight="217" style = "position:absolute;max-width:100%;width:100%;height:auto;left:0%;top:0%;margin-top:0.09728867623604587%;" src =“http://i0.wp.com/uwf.org.in/jibaint/wp-content/uploads/2016/01/slider1.jpg? w=550

所以我想在网址中删除这个高亮的标签和参数 .

1 回答

  • 0

    在Wordpress Stack Exchange上已经很好地回答了这个问题 . 你可以在这里阅读更多:https://wordpress.stackexchange.com/questions/29881/stop-wordpress-from-hardcoding-img-width-and-height-attributes

    有两种主要方法 . 第一个是当你检索图像时,而不是使用get_the_post_thumbnail获得附件ID,然后你可以获得源代码并自己更改标记

    第二个可能是你的解决方案 - 它是一个改变,通过替换/覆盖image_downsize函数来覆盖Wordpress使用的默认图像标记 .

    我在上面提到的链接上很好地解释了这两种方法

相关问题