Skip to content

Commit

Permalink
管理画面の縮小化除外
Browse files Browse the repository at this point in the history
  • Loading branch information
yhira committed Jan 6, 2024
1 parent 1fc7949 commit 8f531d4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 40 deletions.
48 changes: 10 additions & 38 deletions lib/page-speed-up/minify-html.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ function code_minify_call_back($html) {
///////////////////////////////////////
//Alt属性がないIMGタグにalt=""を追加する
$html = preg_replace('/<img((?![^>]*alt=)[^>]*)>/i', '<img alt${1}>', $html);
// //画像タグの border="0"を削除する
// $html = str_replace(' border="0"', '', $html);

//wpForoのHTML5エラー
if (is_wpforo_exist()) {
Expand Down Expand Up @@ -168,6 +166,10 @@ function wp_footer_buffer_end() {
if ( !function_exists( 'wp_head_minify' ) ):
function wp_head_minify($html) {

if (is_admin()) {
return $html;
}

//ヘッダーコードのCSS縮小化
if (is_css_minify_enable()) {
$html = tag_code_to_minify_css($html);
Expand All @@ -191,7 +193,11 @@ function wp_head_minify($html) {

if ( !function_exists( 'wp_footer_minify' ) ):
function wp_footer_minify($html) {
//_v($html);

if (is_admin()) {
return $html;
}

//フッターコードのCSS縮小化
if (is_css_minify_enable()) {
$html = tag_code_to_minify_css($html);
Expand Down Expand Up @@ -226,7 +232,7 @@ function has_match_list_text($text, $list){
if ( !function_exists( 'convert_lazy_load_tag' ) ):
function convert_lazy_load_tag($the_content, $media){
//AMP・アクセス解析ページでは実行しない
if (is_amp() || is_analytics_access_php_page() || is_feed()) {
if (is_amp() || is_analytics_access_php_page() || is_feed() || is_admin()) {
return $the_content;
}

Expand Down Expand Up @@ -346,37 +352,3 @@ function convert_all_lazy_load_tag($html){
return $html;
}
endif;

//サムネイル画像のLazy Load置換
// add_filter('post_thumbnail_html', 'post_lazy_load_thumbnail_html', 10, 5);
// if ( !function_exists( 'post_lazy_load_thumbnail_html' ) ):
// function post_lazy_load_thumbnail_html($html, $post_id, $post_thumbnail_id, $size, $attr){
// // _v($html);
// //WordPress5.5のLazy Load環境が有効か
// if (is_wp_lazy_load_valid()
// //管理画面では動作させない
// && !is_admin()
// //投稿のアイキャッチの場合は'thumb160'のような
// //文字列ではなく配列が入るので除外
// && !is_array($size)
// //既に標準のLazy Loadが入っている場合は実行しない
// && !includes_string($html, ' loading="lazy"')
// ) {
// $html = convert_all_lazy_load_tag($html);
// }
// return $html;
// }
// endif;

// //アバター画像のLazy Load置換
// add_filter('get_avatar', 'get_avatar_lazy_load_thumbnail_html');
// if ( !function_exists( 'get_avatar_lazy_load_thumbnail_html' ) ):
// function get_avatar_lazy_load_thumbnail_html($avatar){
// // _v($avatar);
// //WordPress5.5のLazy Load環境が有効か
// if (is_wp_lazy_load_valid()) {
// $avatar = convert_all_lazy_load_tag($avatar);
// };
// return $avatar;
// }
// endif;
2 changes: 0 additions & 2 deletions lib/utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -969,8 +969,6 @@ function wp_add_css_custome_to_inline_style(){
//スキンを使用しない場合
wp_add_inline_style( THEME_NAME.'-style', $css_custom );
}


}
endif;

Expand Down

0 comments on commit 8f531d4

Please sign in to comment.