前言介紹
- 這款 WordPress 外掛「Load Video On Click」是 2022-01-05 上架。
- 目前有 100 個安裝啟用數。
- 上一次更新是 2025-04-18,距離現在已有 16 天。
- 外掛最低要求 WordPress 4.6 以上版本才可以安裝。
- 外掛要求網站主機運作至少需要 PHP 版本 5.6 以上。
- 尚未有人給過這款外掛評分。
- 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。
外掛協作開發者
giuse |
外掛標籤
video | videos | performace |
內容簡介
只有在點選播放按鈕後才載入影片,可以避免影片影響效能。
如何在點選時載入影片
安裝並啟用 Load Video On Click 外掛
使用捷徑 [load_video_on_click](參見下文)嵌入影片,或啟用 Video 和 Embed 區塊上的「點選載入」開關(Gutenberg 時)
與其他建構器的整合
您可以始終加入所提供的捷徑,無論使用哪種建構器。不過,實際版本提供了以下建構器的完整整合(不需要捷徑):
WPBakery
Gutenberg
捷徑
捷徑名稱:load_video_on_click
捷徑參數:
link: 影片 URL
el_id:自定 CSS 的 ID
el_aspect:影片長寬比
el_class:自定 CSS 的類別
image_placeholder:載入影片之前要載入的圖片。可以使用圖片的 ID 或 URL。
load_on_click:設定為 ON,僅在點擊按鈕後載入影片,或設定為 OFF,在頁面載入時就載入了
捷徑範例:
[load_video_on_click link=”https://www.youtube.com/watch?v=AQ3FoNHC6SU” image_placeholder=”356″]
如果您嵌入 YouTube 影片並沒有設定影像佔位符參數,外掛將會直接取得影片的預設影像。
對於其他影片供應商或如果您自行託管影片檔案,您需要設置影像佔位符參數,否則人們將在載入影片之前只看到播放按鈕。
Gutenberg
如果您使用 Gutenberg,Embed 和 Video 區塊將會有「點擊載入」選項。啟用該選項,即可在點擊播放按鈕後載入嵌入式影片。
別忘了設定海報圖片。它將在開始播放影片之前作為占位符。
協助
如果有任何問題或出現問題,請隨時在支援論壇上開立新討論串。
開發人員專區
過濾器鉤子
'load_video_on_click_for_blocks'
它啟用/禁用已使用 Video 和 Embed 區塊(Gutenberg)添加的現有影片的點擊加載。
範例:
add_filter( 'load_video_on_click_for_blocks','__return_true' ); //它啟用所有使用 Video 和 Embed 區塊添加的影片的點擊加載
'load_video_on_click_image_placeholder'
您可以使用它取代影片白光占位符。
範例:
add_filter( 'load_video_on_click_image_placeholder',
function( $url,$attrs ){
//$attrs 是捷徑的參數陣列,在 Gutenberg 區塊中是區塊的屬性
if( false !== strpos( $url,'yout' ) ){
//所有 Google YouTube 影片使用相同的影像佔位符
return wp_get_attachment_url( 2009 );
}
return $url;
},2,20
);
原文外掛簡介
Videos will not worse anymore the performance if they load only after clicking on the play button.
How to load videos on click
Install and activate Load Video On Click
Embed the videos using the shortcode [load_video_on_click] (see below) or by activating the switch “Load on click” of the Video and Embed blocks (in case of Gutenberg)
Integrations
You can always add the provided shortcode, no matter which builder you are using. However, the actual version provides a full integration with the following builders (no need for the shortcode):
WPBakery
Gutenberg
Shortcode
Shortcode name: load_video_on_click
Shortcode parameters:
link: Video URL
el_id: ID for custom CSS
el_aspect: video aspect ratio
el_class: class for custom CSS
image_placeholder: Image to be loaded instead of the video. You can use the ID or the URL of the image.
load_on_click: Set on to load the video only after clicking on the button, or off to load it on page loading
Shortcode example:
[load_video_on_click link=”https://www.youtube.com/watch?v=AQ3FoNHC6SU” image_placeholder=”356″]
IF you embed a Youtube video and don’t set the image placeholder parameter, the plugin will get it directly from Youtube.
For the other video providers or if you self host the video file, you need to set the parameter image_placeholder, in another case people will only see a play button before loading the video.
Gutenberg
If you use Gutenberg, the blocks Embed and Video will have the switch “Load on click”. Activate that switch to load the embedded video after clicking on the play button.
Don’t forget to set a Poster Image. It will be taken as placeholder before starting the video.
Help
For any question or if something doesn’t work, don’t hesitate to open a thread on the support forum.
For developers
Filter hooks
‘load_video_on_click_for_blocks’
It enables/disables the loading on click for existing videos added with the Video and Embed blocks (Gutenberg).
Example:
add_filter( 'load_video_on_click_for_blocks','__return_true' ); //It enables the loading on click for all videos added with the Video and Embed blocks
‘load_video_on_click_image_placeholder’
You can use it to replace the image placeholder.
Example:
add_filter( 'load_video_on_click_image_placeholder',function( $url,$attrs ){
//$attrs is the array of parameters in case of shortcode, and the block attributes in case of Gutenberg blocks
if( false !== strpos( $url,'yout' ) ){
//Same image placeholder for all Youtube videos
return wp_get_attachment_url( 2009 );
}
return $url;
},2,20 );
各版本下載點
- 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
- 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Load Video On Click」來進行安裝。
(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。
0.0.1 | 0.0.2 | 0.0.3 | 0.0.4 | 0.0.5 | trunk |
延伸相關外掛(你可能也想知道)
NavThemes Employee Ratings 》, 專業性, 效率和技術知識, 幫助你的團隊成員。, 主動性, 假期, , 透過 Timesheet,您的員工可以追蹤時間。他們每天在任何專案或任何任務上花費的時間。, 在...。