
內容目錄
內容簡介
此外掛會自動加入最新 Github 儲存庫發布的壓縮檔案下載鏈接,
使用簡碼 [latest_github_release user=”github” repo=”hub”]
使用說明
在想要加入的文章、頁面或小工具中加入簡碼[latest_github_release user="github" repo="hub"],並儲存即可開始使用。
選項
使用者可以通過一些自定義簡碼參數,例如:
按鈕名稱 = [latest_github_release name="Desired Name"]
使用latest_github_release_link過濾器鉤子
`
add_filter( ‘latest_github_release_link’, ‘gmlatest_github_release_link’, 10, 3 );
function gmlatest_github_release_link( $html, $atts, $zip_url ) {
// 為<a>添加另一個類別。
$atts['class'] .= ' another-class';
// 在標記周圍添加<h2>.
$html = (
'<h2><a href="' . esc_attr( $zip_url ) . '"'
. ' class="' . esc_attr( $atts['class'] ) . '">'
. esc_html( $atts['name'] )
. '</a></h2>'
);
return $html;
}
`
注意:
1. 名稱屬性的預設值為單詞"Download"。
1. 名稱與user和repo等其他屬性相結合使用。
貢獻/問題/反饋
如果您有反饋,請撰寫一個問題。您也可以分叉代碼,在 Github 上提交PR。
外掛標籤
開發者團隊
原文外掛簡介
Automatically add a download link to the latest Github repo release zips with
a shortcode [latest_github_release user=”github” repo=”hub”]
Usage
Add the shortcode [latest_github_release user="github" repo="hub"] to desired post/page/widget and save to have the code working.
options
One can add some customization to the shortcode such as
Name of the button = [latest_github_release name="Desired Name"]
Use latest_github_release_link filter Hook
`
add_filter( ‘latest_github_release_link’, ‘gmlatest_github_release_link’, 10, 3 );
function gmlatest_github_release_link( $html, $atts, $zip_url ) {
// Add another class to the .
$atts['class'] .= ' another-class';
// Add
around the tag.
$html = (
'
'
. esc_html( $atts['name'] )
. '
'
);
return $html;
}
`
Note:
1. Name attribute defaults to the word “Download”
1. Name is usedin combination with the other attribbutes user & repo.
Contribute/Issues/Feedback
If you have any feedback, just write an issue. Or fork the code and submit a PR on Github.
延伸相關外掛
. esc_html( $atts['name'] )
. '
);
`
Note:
1. Name attribute defaults to the word “Download”
1. Name is usedin combination with the other attribbutes user & repo.
Contribute/Issues/Feedback
If you have any feedback, just write an issue. Or fork the code and submit a PR on Github.
