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

前端之家收集整理的这篇文章主要介绍了禁用 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 插件

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

原文链接:https://www.f2er.com/wordpress/238459.html

猜你在找的wordpress相关文章