
內容簡介
這個外掛可以新加入 <img> HTML 標籤的 [img] 短碼代碼。它也可以在使用者按下「加入媒體」按鈕時,透過自動插入格式化的短碼代碼到編輯器內,實現在文章/頁面中新增媒體的功能。
您可以簡單地加入帶有媒體 ID 的 [img] 短碼代碼,如下所示:
[img 123 /]
或者,您可以加入完整格式化的 [img] 短碼代碼:
[img 123 align="center" size="full" caption="Sample text" title="Sample text" desc="Sample text" alt="Sample text" url="http://example.com/" /]
它支援 srcset 和 sizes 參數。
技巧與提示
您可以使用篩選器(filter)自訂要顯示的 img 標籤樣式模板,如下所示:
add_filter( 'Clearcode\IMG_Shortcode\template', function() { return '/themes/clearcode.cc/templates/img.php'; } );
外掛標籤
開發者團隊
原文外掛簡介
This plugin adds the [img] shortcode which replaces the html tag. It’s also enables adding new media to post/page via the ‘Add media’ button by automatically inserting the formatted shortcode code to the editor.
You can simply add the [img] shortcode with a media ID to display:
[img 123 /]
or a fully formatted [img] shortcode:
[img 123 align="center" size="full" caption="Sample text" title="Sample text" desc="Sample text" alt="Sample text" url="http://example.com/" /]
It’s supports srcset and sizes parameters.
Tips & Tricks
You can use your own html template file for displaying the img tag by using filter:
add_filter( 'Clearcode\IMG_Shortcode\template', function() { return '/themes/clearcode.cc/templates/img.php'; } );
