內容簡介
此外掛在側邊欄顯示 Github 存儲庫的最新提交。
功能
側邊欄小工具
此外掛提供一個側邊欄小工具,可以配置以在側邊欄中顯示 Github 存儲庫的提交。您可以擁有多個不同配置存儲庫的小工具。
模板函數
除了使用小工具之外,您還可以使用以下模板函數在主題的任何位置顯示 Github 存儲庫的提交
get_github_commits($user, $repo, $count);
以下選項可以通過 $options 陣列傳遞
$user (字符串)- Github 用戶名稱。
$repo (字符串)- Github 存儲庫名稱。
$count (整數)- 默認為 5 - 要顯示的最新提交數量
自定義欄位
您還可以將每個文章或頁面的存儲庫指定為自定義欄位。您可以在添加/編輯文章屏幕的 “WP Github 提交頁面字段” 部分下添加它。
快取
此外掛將從 Github 檢索的提交進行緩存,緩存時間為 5 小時。
使用 CSS 进行样式设置
此外掛添加以下 CSS 類。如果您想自定義小工具的外觀,可以通過為這些 CSS 類添加自定義樣式來更改它。
外部 ul 標籤具有類 github-commits
每個 li 標籤具有類 github-commit
疑難排解
如果出現超時或錯誤“WP HTTP Error: name lookup timed out”,則表示您的服務器在 Github 响應之前未超時。
您可以使用此要點中的代碼來增加超時時間。
翻譯
此外掛附帶了 POT 文件。如果您願意為外掛進行翻譯,使用 POT 文件為您的語言創建 .po 文件,並讓我知道。我會在給您信用後將其添加到此外掛。
開發
此外掛的開發在 Github 上進行。如果您想為外掛做出貢獻,請在 Github 上 fork 該項目,然後向我發送拉取請求。
如果您不熟悉 git 或 Github,請參閱此指南以查看如何 fork 和發送拉取請求。
如果您正在尋找點子,可以從以下任務中開始 🙂
未來要做的事
支援簡碼
隱藏作者名稱的能力
使小工具內容的輸出可插件化
支援
如果您發現錯誤/問題或有功能請求,則請在 github issues 中發布它們
如果您有關於使用或需要協助排除故障的問題,請在 WordPress 論壇上發布,或在 外掛的主頁上留言
如果您喜歡此外掛,請在 WordPress 外掛庫頁面 上留下評論/反饋。
如果有其他事情,請在 twitter 上與我聯繫。
保持更新
我將在此 Plugin 中發布更新。
外掛標籤
開發者團隊
原文外掛簡介
Displays the latest commits of a github repo in the sidebar.
Features
Sidebar Widget
The Plugin provides a sidebar widget which can be configured to display commits from a github repo in the sidebar. You can have multiple widgets with different repo configured for each one of them.
Template function
In addition to using the widget, you can also use the following template function to display the commits of a github repo, anywhere in the theme
get_github_commits($user, $repo, $count);
The following options can be passed in the $options array
$user (string) – Github user name.
$repo (string) – Github repo name.
$count (int) – default 5 – Number of recent commits to show
Custom field
You can also specify the repo for each post or page as a custom field. You can add it under the “WP Github Commits Page fields” section in the Add/Edit post screen.
Caching
The Plugin caches the commits that is retrieved from Github for 5 hours.
Styling using CSS
The Plugin adds the following CSS classes. If you want to customize the look of the widget then can change it by adding custom styles to these CSS classes.
The outer ul tag has the class github-commits
Every li tag has the class github-commit
Troubleshooting
If you get timeouts or the error “WP HTTP Error: name lookup timed out” then it means that your server is not timing out before github can respond.
You can use the code from this gist to increase the timeout.
Translation
The pot file is available with the Plugin. If you are willing to do translation for the Plugin, use the pot file to create the .po files for your language and let me know. I will add it to the Plugin after giving credit to you.
Development
The development of the Plugin happens over at github. If you want to contribute to the Plugin, fork the project at github and send me a pull request.
If you are not familiar with either git or Github then refer to this guide to see how fork and send pull request.
If you are looking for ideas, then you can start with one of the following TODO items 🙂
TODO
Shortcode support
Ability to hide author name
Make the output of widget content plugable
Support
If you have found a bug/issue or have a feature request, then post them in github issues
If you have a question about usage or need help to troubleshoot, then post in WordPress forums or leave a comment in Plugins’s home page
If you like the Plugin, then kindly leave a review/feedback at WordPress repo page.
If anything else, then contact me in twitter.
Stay updated
I would be posting updates about this Plugin in my blog and in Twitter. If you want to be informed when new version of this Plugin is released, then you can either subscribe to this blog’s RSS feed or follow me in Twitter.
Also checkout the other WordPress Plugins that I have created.
Readme Generator
This Readme file was generated using wp-readme, which generates readme files for WordPress Plugins.
