
在做 WordPress 文件庫主題的時候遇到個問題,不管上傳什麼尺寸的圖片都會需要強制裁切,然後裁切後的圖片尺寸又是模糊不清晰,在視網膜螢幕下顯示的效果極差。
用下面的程式碼可以跳過主題的強制裁切,新增到子主題的 function.php 檔案裡去就行。
function logo_size_change(){
remove_theme_support( 'custom-logo' );
add_theme_support( 'custom-logo', array(
'height' => 100,
'width' => 400,
'flex-height' => true,
'flex-width' => true,
) );
}
add_action( 'after_setup_theme', 'logo_size_change', 11 );