微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

禁用 WordPress 4.4+ 版本的响应式图片功能

站长朋友们在使用的过程中会发现,自WordPress 4.4版本开始,可以根据不同的条件(屏幕大小、可视区大小 和 屏幕分辨率等)为用户显示不同大小的图片,

disableresponsiveimages

这个功能认开启的,当然如果您不想要这个效果,可以切换到当前主题目录,添加下面的代码到 functions.PHP 文件即可:

Crayon-5c891d1aedee7582877975" class="Crayon-Syntax Crayon-theme-classic Crayon-font-monaco Crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouSEOver" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
Crayon-toolbar" data-settings=" mouSEOver overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">Crayon-title">functions.PHP
Crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
Crayon-button Crayon-nums-button" title="Toggle Line Numbers">
Crayon-button-icon">
Crayon-button Crayon-plain-button" title="Toggle Plain Code">
Crayon-button-icon">
Crayon-button Crayon-wrap-button" title="Toggle Line Wrap">
Crayon-button-icon">
Crayon-button Crayon-expand-button" title="Expand Code">
Crayon-button-icon">
Crayon-button Crayon-copy-button" title="copy">
Crayon-button-icon">
Crayon-button Crayon-popup-button" title="Open Code In New Window">
Crayon-button-icon">
Crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
Crayon-plain-wrap">
Crayon-main" style="">Crayon-table">Crayon-row">
Crayon-nums " data-settings="show">
Crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
Crayon-num" data-line="Crayon-5c891d1aedee7582877975-1">1
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d1aedee7582877975-2">2
Crayon-num" data-line="Crayon-5c891d1aedee7582877975-3">3
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d1aedee7582877975-4">4
Crayon-code">
Crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
Crayon-line" id="Crayon-5c891d1aedee7582877975-1">Crayon-c">/*
Crayon-line Crayon-striped-line" id="Crayon-5c891d1aedee7582877975-2">Crayon-c">禁用 wordpress 4.4+ 的响应式图片功能
Crayon-line" id="Crayon-5c891d1aedee7582877975-3">Crayon-c">*/
Crayon-line Crayon-striped-line" id="Crayon-5c891d1aedee7582877975-4">Crayon-e">add_filterCrayon-sy">(Crayon-h"> Crayon-s">'max_srcset_image_width'Crayon-sy">,Crayon-h"> Crayon-e">create_functionCrayon-sy">(Crayon-h"> Crayon-s">''Crayon-sy">,Crayon-h"> Crayon-s">'return 1;'Crayon-h"> Crayon-sy">)Crayon-h"> Crayon-sy">)Crayon-sy">;

如果你不想编辑文件,可以下载安装 wordpress.org/plugins/disable-responsive-images/" target="_blank" rel="nofollow">disable Responsive Images 插件

注意:有些站长朋友们反馈,当禁用这个功能以后,又拍等插件无法正常工作,所以一旦出现图片无法正常加载的时候,检查下是不是因为禁用这个功能导致的!

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐