[WordPress] 外掛分享: Optimize More!

WordPress 外掛 Optimize More! 的封面圖片。

前言介紹

  • 這款 WordPress 外掛「Optimize More!」是 2022-09-11 上架。
  • 目前有 400 個安裝啟用數。
  • 上一次更新是 2024-02-20,距離現在已有 438 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
  • 外掛最低要求 WordPress 5.8 以上版本才可以安裝。
  • 外掛要求網站主機運作至少需要 PHP 版本 7.4 以上。
  • 有 9 人給過評分。
  • 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。

外掛協作開發者

aryadhiratara |

外掛標籤

JS | css | Optimize | javascript | core web vitals |

內容簡介

這是一個「自助」WordPress頁面速度優化套件。

控制您的CSS和JS交付:異步載入CSS,延遲CSS和JS直到用戶互動,刪除未使用的CSS和JS文件,預加載關鍵CSS和JS等等。

優化網頁實際上就是控制資源如何交付。這個外掛可以讓您在這些文章/頁面類型中選擇不同的資源延遲/預加載/異步載入/移除:首頁、頁面除首頁、單篇文章(如果您使用 WooCommerce,還包括商店頁面、產品類別頁面和單一產品頁面)。

針對每個文章類型優化每個CSS和JS的交付。您可以個別選擇每個CSS和JS以及所需的執行類型。

這個外掛的靈感來自於強大的來自Gijo Varghese的 Flying Scripts。使用HTML Dom解析器來操作您的頁面HTML,因此我們可以簡單地使用資源的關鍵字來定位它們。不需要再煩惱尋找我們的外掛程式掛載的正確CSS和JSS處理程序。

特點

新功能!-從1.0.7開始-為刪除Gutenberg CSS功能(在額外標籤中)添加了一個新功能。這個新功能將會删除合併的CSS(wp-block-library),您的頁面只會載入您在頁面上使用的每個區塊的CSS(如果您只使用了核心區塊!)。說明現在更改為「有條件地載入每個核心區塊的CSS」。
如果您還需要在某些頁面上使用原生Gutenberg核心區塊,這將使您省去擔心的時間。就像之前的功能一樣,如果您在頁面上不使用任何核心區塊,CSS將根本不會載入。每個核心區塊的CSS只會在渲染頁面時被掛載到頁面中。
注意:當您結合此功能與「刪除FSE全域樣式」功能時,內置的「全局樣式」也只會在您使用核心區塊時加載。

異步載入CSS-有選擇性地在選定的文章/頁面類型上異步載入CSS文件。

延遲CSS和JS到用戶互動時才載入-可選擇性地在選定的文章/頁面類型上延遲CSS/JS載入,直到用戶互動。

預先加載關鍵CSS、JS和字型文件-可選擇性地在選定的文章/頁面類型上預先加載關鍵的CSS/JS/字型檔案。

移除未使用的CSS和JS文件-可選擇性地在選定的文章/頁面類型上移除未使用的CSS/JS檔案。

使用案例:

有只會用在頁面下方的CSS文件嗎?延遲它們。
有不需要在初始頁面渲染時使用的JS文件嗎?延遲它們。
有在頁面上方使用的CSS檔案嗎?預先加載它們。
需要在開始時載入jQuery等JS檔案嗎?預先加載它們。
需要解決「消除渲染阻塞資源」在Google Page Speed Insights中的警告?異步或預先加載它們。
想要對所有特定外掛資源進行定位?將外掛關鍵字或/資料夾名稱/放入輸入欄位中。
想要只對一個特定的外掛資源進行定位?將資源檔的名稱(例如:style.min.css)放入輸入欄位中(如果您的頁面有多個使用相同檔名的資源,請包括資料夾路徑)。

我建立了這個外掛來優化我的客戶的網站。即使在啟用緩存外掛之前,我也可以得到非常好的分數。

如何使用這個外掛的簡單教程:使用Optmize More Plugin的方法。

原文外掛簡介

A ‘Do It Yourself’ WordPress Page Speed Optimization Pack.
Optimizing web pages is really just about controlling how assets are delivered.
Optimize your site further. Load faster on GTmetrix, Get better scores on Google Page Speed Insight.
Control your CSS & JavaScripts Delivery: Load CSS Asynchronously, Delay CSS & JavaScript until User Interaction, Remove Unused CSS & JavaScript Files, Preload Critical CSS & JavaScript, Defer JavaScripts, and more.
You can choose each CSS & JavaScripts individually and what type of execution is required per each post types.
This plugin inspired by the mighty Flying Scripts from Gijo Varghese. Using HTML Dom Parser to manipulate your page’s HTML, so we can simply use the keyword of the assets to target them.
Main Features

Load CSS Asynchronously — load any CSS file(s) asynchronously on selected post/page types.

Delay CSS and JavaScripts until User Interaction — delay any CSS/JavaScripts load until user interaction on selected post/page types.
Note:

By default, the delay JavaScripts and CSS features are configured to user interaction based. You can change that using filter.
If you prefer to use ‘exclusions’, you can simply delay all JavaScripts using “.js” keywords, and use provided filter to exclude specific JavaScripts.

Defer JavaScripts — defer loading any JavaScript file(s) on selected post/page types.

Advance Defer JavaScripts — hold any JavaScript file(s) load until everything else has been loaded. Adapted from the legendary varvy’s defer JavaScripts method *recommended for defer loading 3rd party scripts like ads, pixels, and trackers

Preload Critical CSS, JavaScripts, and Font Files — preload any critical CSS/JavaScript/Font file(s) on selected post/page types.

Inline CSS and JavaScript Files — inline any critical CSS/JavaScript file(s) on selected post/page types. *warning: Inlining multiple / large files might slow down your site’s performance. Enabling this without using a caching system is generally not recommended.

Remove Unused CSS and JavaScripts Files — remove any unused CSS/JavaScripts file(s) on selected post/page types.

Use case:

Have CSS files that are only be used in the below the fold area? Delay them.
Have JavaScripts files that are not required in initial page rendering? Delay them.
Have CSS files that are used in the above the fold area? Preload them.
Have JavaScripts files such as jQuery that are needed to be load since the beginning? Preload them.
Have CSS files that are critical for above the fold area? Inline them.
Need to remove “Eliminate Render Blocking Resources” warnings on Google Page Speed Insights? Async, Defer, Inline, or Preload them.

Other Features

Load Gutenberg CSS conditionally — This feature will make the combined CSS (wp-block-library) removed and your page will only load the CSS of each block that you use on the page (and only if you use one of the core blocks!). Each CSS of the core blocks will only get enqueued when the block gets rendered on a page. This will save you from worrying if you still need to use the native Gutenberg core blocks in some of your pages.
Note: the inline “global-styles” will also only load if you use one of the core blocks when you combine this feature with the Remove FSE Global Styles feature.

Remove FSE Global Styles — Remove WP “global-styles-inline-css”. Note: this will still conditionally loaded if you enable Load Gutenberg CSS conditionally feature.

Remove SVG Duotone Filter.

Filter Google Fonts — Filter the Google Font Characters to use most common characters only. In most font families, this will significantly reduce the font file size. *remember to use the web-safe font that is most similar to the font you are using as the font family fallback or you can simply modify the default character using the provided filter.

Combined Google Fonts — Combine google fonts css into one single line *only works for google font url(s) that are using the latest Google Font API (css2).

Select Font Display — Choose the best google fonts’ font-display strategy for your website.

Remove Passive Listener Warnings — Remove the “Does not use passive listeners to improve scrolling performance” warning on Google PageSpeed Insights

Prefetch Pages — Prefetch in view links so visitors can switch pages (more) instantly. *based on Gijo’s Flying Pages

Optimize WC Cart Fragments — Disable WC Cart Fragments, only when it’s empty. *based on Optimocha’s (Barış Ünver) Disable Cart Fragments

Remove WooCommerce Blocks CSS.

Disable jQuery Migrate.

Disable WP Embeds.

Disable WP Emojis.

Lazyload, Preload, and More — Add Lazyload, Preload, and More features. This is a non JavaScript version of Lazyload, preload, and more. *lazyload applied for images/iframes tag only. if you need to lazyload css background images, use the Lazyload, preload, and more plugin instead.

Control your images and iframes delivery
Automatically preload featured images
Add images dimensions (also able to add SVG images dimensions)

 
A simple tutorial of how to use this plugin: How to use Optmize More Plugin (Indonesian Version: Cara mempercepat loading WordPress dengan plugin Optimize More).
Big thanks to Gijo Varghese, without his codes in Flying Scripts, I can never be able to build this plugin. Thanks Gijo! 🙂
Credits

Gijo Varghese for his codes in Flying Scripts and Flying Pages
Barış Ünver for his codes in Disable Cart Fragments

Disclaimer

This plugin should works well with any caching plugins.

This plugin only adds 1 extra row to your database. And it will self delete upon uninstallation.

I built this plugin to optimize my Clients’ site. And I can get a very good scores even before activating my caching plugin.

Available Filters
To change the delay configuration:
By default, the delay JavaScripts and CSS are configured to user interaction based. But you can change that using filter:
For delay CSS, e.g.:
add_filter( 'om_delay_css_time', function($om_delay_css_time) {
return '3*1000';
} );

For delay JavaScripts, e.g.:
add_filter( 'om_delay_css_time', function($om_delay_css_time) {
return '3*1000';
} );

or if you want to change it for specific page only:
For delay CSS, e.g.:
add_filter( 'om_delay_css_time', function($om_delay_css_time) {
if (is_front_page()) {
return '3*1000';
}
else {
return $om_delay_css_time;
}
} );

For delay JavaScripts e.g.:
add_filter( 'om_delay_js_time', function($om_delay_js_time) {
if (is_front_page()) {
return '3*1000';
}
else {
return $om_delay_js_time;
}
} );

To use Exclusions instead of Inclusions
If you prefer to use ‘exclusions’ method, simply delay all JavaScript files using “.js” keyword, and use the provided filters to exclude specific JavaScript files:
Example filter to add exclude list for the whole site (general):
add_filter('delay_js_exclude_list_default', function($exclusion_list) {
$exclusion_list[] = 'jquery-core';
$exclusion_list[] = 'js-cookie';
$exclusion_list[] = 'wc-add-to-cart-js';
return $exclusion_list;
});

Example filter to add exclude list for Homepage option:
add_filter('delay_js_exclude_list_front_page', function($exclusion_list) {
$exclusion_list[] = 'jquery';
$exclusion_list[] = 'custom-js';
return $exclusion_list;
});

Example filter to add exclude list for Custom Page option:
add_filter('delay_js_exclude_list_pages', function($exclusion_list) {
$exclusion_list[] = 'jquery';
$exclusion_list[] = 'another-js';
return $exclusion_list;
});

Example filter to add exclude list for Archives option:
add_filter('delay_js_exclude_list_archives', function($exclusion_list) {
$exclusion_list[] = 'jquery';
$exclusion_list[] = 'another-js';
return $exclusion_list;
});

Example filter to add exclude list for Singular option:
add_filter('delay_js_exclude_list_singular', function($exclusion_list) {
$exclusion_list[] = 'jquery';
$exclusion_list[] = 'another-js';
return $exclusion_list;
});

Example filter to add exclude list for WooCommerce Products option:
add_filter('delay_js_exclude_list_wc_product', function($exclusion_list) {
$exclusion_list[] = 'jquery';
$exclusion_list[] = 'another-js';
return $exclusion_list;
});

Example filter to add exclude list for WooCommerce Archives option:
add_filter('delay_js_exclude_list_wc_archives', function($exclusion_list) {
$exclusion_list[] = 'jquery';
$exclusion_list[] = 'another-js';
return $exclusion_list;
});

To modify the Filter Google Font Characters
By default, this feature filtered the Google Font Characters to only use:
1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz%20!&"#$%\'()*+,-./:;?@[\\]^_`{|}~%26≤≥±√$€£¥•©®™

You can modify the characters using this filter:
Example filter to add some extra characters:
add_filter('font_characters', function ($fontCharacters) {
// Modify the characters as needed
$fontCharacters .= 'éèêñ';
return $fontCharacters;
});

Example filter to fully use your preferred characters:
add_filter('font_characters', function ($fontCharacters) {
// Modify the characters as needed
$fontCharacters = '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz%20!"#$%\'()*+,-./:;';
return $fontCharacters;
});

*note the ‘dot’ difference
Lazy Load, Preload, and more filters
Example filter to add extra lazyload exclude list:
add_filter( 'opm_exclude_lazy_class', function($opm_exclude_lazy_class) {
return array(
'my-logo', 'my-hero-img', 'exclude-lazy'
);
} );

Example filter to change the image sizes for preload featured image:
add_filter( 'opm_featured_image_size', function($image_size, $post) {
if ( is_singular( 'post' ) ) { return 'large'; }
elseif ( is_singular( 'product' ) ) { return 'full'; }
else { return $image_size; }
}, 10, 2 );

 
Need Help?
Still having trouble to speed up your site and need someone to do that for you? Try my WordPress Speed Optimization Service.
 
Check out my other plugins:

Optimize More! Images
A simple yet powerfull image, iframe, and video optimization plugin.
Lazyload, Preload, and more!
A simplified version of Optimize More! Images. This tiny little plugin (around 14kb zipped) is able to do what Optimize More! Images can do but without UI for settings (you can customize the default settings using filters).
Animate on Scroll
Animate any Elements on scroll using the popular AOS JS library simply by adding class names.
Shop Extra – WooCommerce Extras
A lightweight plugin to enhance your WooCommerce & Business site. Floating WhatsApp Chat Widget, WhatsApp Order Button for WooCommerce, Hide/Disable WooCommerce Elements, WooCommerce Strings Translations, add Extra Product Tabs, add Date Picker to products, limit order quantity, add Custom Option to Checkout Page, Add Edit Order features to Checkout page, and many more.
Image & Video Lightbox

 

各版本下載點

  • 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
  • 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Optimize More!」來進行安裝。

(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。


1.0.0 | 1.0.1 | 1.0.2 | 1.0.3 | 1.0.4 | 1.0.5 | 1.0.6 | 1.0.7 | 1.0.8 | 1.0.9 | 1.1.0 | 1.1.1 | 2.0.0 | 2.0.1 | 2.0.2 | 2.0.3 | trunk |

延伸相關外掛(你可能也想知道)

  • WPCode – Insert Headers and Footers + Custom Code Snippets – WordPress Code Manager 》插入標頭和頁腳 + 完整的 WordPress 代碼片段外掛, WPCode (前稱为 WPBeginner 的 "插入標頭和頁腳")是使用率超过 100 万个网站的 WordPress 代码片段外掛中...。
  • Code Snippets 》Code Snippets 是在您的網站上運行程式碼片段的簡單,清潔和簡單的方法。它消除了將自定義片段添加到您的佈景主題的 functions.php 檔案的需求。, 現在提供 C...。
  • Widget CSS Classes 》Widget CSS Classes 可以讓您給 WordPress Widget 添加自定義的 class 和 id, 請注意,此外掛並不支援輸入自定義的 CSS。您需要修改主題的 style.css,或加入...。
  • Simple Custom CSS Plugin 》無需麻煩地將自訂 CSS 新增到 WordPress 網站中。, 這是一個易於使用的 WordPress 外掛,可以添加自訂 CSS 樣式以覆寫外掛和佈景主題的預設樣式。該外掛旨在...。
  • Simple CSS 》需要在你的網站中添加自定義 CSS 嗎?Simple CSS 提供一個很棒的管理編輯器和 Customizer 中的即時預覽編輯器,讓你能夠輕鬆添加 CSS。, 想讓你的 CSS 僅應用...。
  • WP Add Custom CSS 》WP Add Custom CSS 外掛允許您在整個網站及個別文章、頁面和自訂文章類型(例如 Woocommerce 產品)中添加自訂的 CSS。, 對整個網站應用的 CSS 樣式將覆蓋您...。
  • Visual CSS Style Editor 》Style your WordPress site visually. Discover the most popular front-end design plugin! Try live demo., , Visual CSS Editor, The plugin allows you t...。
  • WP-SCSS 》此外掛使用 ScssPhp,在 WordPress 安裝中編譯 .scss 檔案。包含設定頁面,可配置目錄、錯誤報告、編譯選項和自動佇列。, 此外掛僅在更改 .scss 檔案時進行編...。
  • Clear Cache for Me 》Clear Cache For Me 是一個 WordPress 外掛,適用於 W3 Total Cache 和 WP Super Cache,因為它們不知道 widget 何時更新,且在更新 widget 和 menu 時都不會...。
  • Scripts n Styles 》這個外掛讓管理員用戶能夠將自訂的 CSS 和 JavaScript 直接添加到個別文章、頁面或任何註冊的自訂文章類型中,也可以將類別添加到 body 標籤和文章容器中。還...。
  • Forget About Shortcode Buttons 》相容於 WordPress 傳統編輯器,Gutenberg 整合即將推出🙂, 歡迎提出功能需求/建議!, 即忘短碼(FASC)按鈕是在所見即所得編輯器中及網站佈景主題中加入 CSS 按...。
  • Code Embed 》注意: WordPress 5.0 及以上版本的使用者請查看常見問題以了解如何在區塊編輯器中使用此外掛。, Code Embed 外掛允許您在文章中嵌入程式碼(JavaScript 和 H...。
  • Raw HTML 》is capability is only granted to administrators. If you’re not an admin, you will need to ask them to add it to your role., Raw HTML is not r...。
  • Microthemer Lite – Visual Editor to Customize CSS 》Microthemer是一個輕量級且功能強大的視覺編輯器,可以自訂網站的CSS樣式,從Google字體到響應式佈局,它適用於程式開發人員和非程式開發人員,並與Elementor...。
  • Core Framework 》總結:Core Framework是一個簡單易用、樂趣滿滿的WordPress外掛,如同你的CSS瑞士軍刀,幫助你輕鬆打造完美網站。, , 問題與答案:, - Core Framework是什麼...。

文章
Filter
Apply Filters
Mastodon