
內容簡介
使用 [browser-shot] 短代碼來自動化網站截圖的過程。一個圖示也會被加入 TinyMCE 編輯器中,以方便製作短代碼。
外掛使用從 WordPress.com 取得的「mshots」功能來自動捕捉網站截圖。該功能的非商業使用為免費。
這些圖片會儲存在 WordPress.com 的伺服器上,而不是存儲在你的網站中。圖片會在生成後約 24 小時進行快取再生成。
短代碼預覽
// 基礎截圖,寬度 600 像素
[browser-shot url="https://link-to-website" width="600"]
// 帶有連結到其他網站的截圖
[browser-shot url="https://link-to-website" width="700" link="https://www.binarymoon.co.uk/"]
// 帶有標題(使用預設的 WordPress 標題樣式)的截圖
[browser-shot url="https://link-to-website" width="700"]Add Caption[/browser-shot]
參數說明
url(必填)- 連結網址
width - 圖片寬度
height - 圖片高度
alt - 圖片替代文字
link - 圖將連結到的網址。留空則會連向截圖所在的網站
target - 瀏覽器連結目標,可設置 _blank 以在新視窗中開啟連結
class - 將一個類添加到 browsershots 包裝器
image_class - 將預設的 browsershots 圖像類別alignnone 更改為你選擇的類別
display_link(true 或 false,預設為 true)用於在截圖中顯示連結
post_links(true 或 false,預設為 false)用於連結到截圖所在文章的永久鏈接
代碼生成截圖
如果你想使用這個外掛來在主題中製作截圖,可以使用 BrowserShots::get_shot 方法來實現。
例如:
<img src="<?php echo BrowserShots::get_shot( 'https://prothemedesign.com', 600, 450 ); ?>" />
請注意,必須安裝並啟用外掛才能使用此功能。
get_shot 方法有三個參數:
網址。
寬度。
高度。
從 shotcode 中的其他參數可以在輸出HTML時手動實現。
多站點相容性
Browser Shots 外掛相容於 WordPress Multisite,只需使用 网络启用 功能即可在每個站點啟用短代碼。如果只想在特定站點啟用短代碼,請僅為該站點啟用外掛。
更多資訊
代碼可以在 Github 上找到:Github
你可以在 Twitter 上 聯繫我以提出任何問題或疑慮
外掛標籤
開發者團隊
📦 歷史版本下載
原文外掛簡介
Use the [browser-shot] shortcode to automate the process of taking website screenshots. An icon is also added to the TinyMCE editor to make the shortcode creation process easy.
The plugin uses the ‘mshots’ functionality, from WordPress.com, to automatically take screenshots of websites. This function is free for non-commercial use.
The images are stored on the wordpress.com servers and are not saved onto your own website. The images are cached for roughly 24 hours before being generated again.
Shortcode Preview
// basic shot 600px wide
[browser-shot url="https://link-to-website" width="600"]
// shot with link to other website
[browser-shot url="https://link-to-website" width="700" link="https://www.binarymoon.co.uk/"]
// shot with caption (uses default WordPress caption styles)
[browser-shot url="https://link-to-website" width="700"]Add Caption[/browser-shot]
Available Parameters
url (required) – the url of the link to shorten
width – the width of the image
height – the height of the image
alt – the image alt text
link – where the image links. Left blank it will point to the website where the screenshot is being taken
target – browser target. Set to _blank to open in a new window
class – add a class to the browsershots wrapper
image_class – change the default browsershots image class from alignnone to your chosen class
display_link (true or false – default true) to display a link in your screenshot
post_links (true or false – default false) to link to the permalink of the post the screenshot is on
Generating Screenshots with code
If you want to create screenshots in a theme using this plugin then you can do so using the BrowserShots::get_shot method.
For example:
Keep in mind that the plugin must be installed and activated for this to work.
The get_shot method has 3 parameters.
The url.
The width.
The height.
The other parameters, from the shotcode, can be implemented manually when outputting the html.
Multisite Compatibility
The Browser Shots plugin is compatibly with WordPress Multisite, just use the Network Activate feature to enable the shortcode on every site. If you only want to enable the shortcode for a specific site, activate the plugin for that site only.
More…
The code can be found on Github
You can reach out to me with questions or problems on Twitter
