內容簡介
Plugins List 是一個簡單的 WordPress 外掛,旨在為使用者提供已安裝外掛的清單,並可自訂顯示格式。它能夠展示活動與非活動外掛,並支援多種格式化選項,讓使用者能夠輕鬆管理和展示外掛資訊。
【主要功能】
• 自訂顯示格式的簡單模板系統
• 支援顯示活動與非活動外掛
• 自動限制長描述的字數
• 快速回應的快取輸出
• 可使用短碼顯示已安裝外掛數量
外掛標籤
開發者團隊
原文外掛簡介
This is a simple community WordPress plugin aimed at giving credit where credit is due.
The plugin inserts an XHTML list into any post/page through a shortcode. If you’re into customization, you can specify a format argument and indicate the exact output you are after. There’s also an option to display inactive plugins as well.
Key features include…
A simple template system allows you to format how you’d like the plugin information to be shown
Template tags are available for automatically linked items as well as simple text
Choose from a number of pieces of plugin data to be output
Display inactive plugins as well as active plugins if you wish
Automatically limit long descriptions to specific lengths, and even remove emojis from the output
Output is cached to provide a super-quick response
A separate shortcode allows you to display how many plugins you have!
Thanks to Matej Nastran‘s My plugins, from which Plugins list was initially derived.
Iconography is courtesy of the very talented Janki Rathod.
Please visit the Github page for the latest code development, planned enhancements and known issues
Getting Started
To get a list of the plugins that are installed and activated in your website, insert the following into any post or page:
- [plugins_list]
You can customise the output specifying the format argument and a number of pre-defined tags. Here’s an example:
[plugins_list format="{{LinkedTitle}} ({{LinkedAuthor}}) - {{Description}}{{br/}}"]
The tags are as follows, all defined within double braces…
Title – the plugin title
PluginURI – the URL of the plugin
Author – the plugin author
AuthorURI – the author’s URL
Version – plugin version number
Description – the plugin description
RequiresWP – the minimum required level of WordPress
RequiresPHP – the minimum required level of PHP
LinkedTitle – the title but automatically linked to the corresponding URL
LinkedAuthor – the author, linking to their profile
Active – shows ‘Active’ or ‘Inactive’, depending on the status of the plugin
The plugins list can be freely styled with css, just place any class or id attribute on the format string, or on the elements surrounding it.
Using HTML
If you wish to put HTML in your format then you can. However, this can cause havoc in the Visual editor and even causes extra characters to be passed into the output (rogue paragraph tags, for instance). I therefore highly recommend that, if you wish to add HTML, use double braces instead of < and > around your HTML tags – this plugin will correct this before output but it means the visual editor doesn’t try and interpret the HTML.
For example…
- [plugins_list format="{{li}}{{LinkedTitle}} - {{LinkedAuthor}}{{/li}}"]
The characters will be corrected upon output and you will get a lovely, bulleted, un-ordered list as output.
If you’re using the block editor and need to wrap HTML around the outside of the short code, please see the details further below on the best way to do this.
Additional Parameters
Active & Inactive Plugins
By default, only active plugins are shown, but by using the show_active, show_inactive and show_recent parameters you can change this.
For example, this will show both active and inactive…
[plugins_list format="{{LinkedTitle}} ({{LinkedAuthor}}) - {{Description}}{{br/}}" show_inactive=true]
If you wanted to show just inactive, you’d put..
[plugins_list format="{{LinkedTitle}} ({{LinkedAuthor}}) - {{Description}}{{br/}}" show_inactive=true show_active=false]
If you wanted to show just plugins that are inactive but were recently active, you’d put…
[plugins_list format="{{LinkedTitle}} ({{LinkedAuthor}}) - {{Description}}{{br/}}" show_inactive=false show_active=false show_recent=true]
Link Targets & No Follow
By default links will be followed but you can make these “nofollow” by simply adding the parameter of nofollow=true. For example…
[plugins_list format="{{LinkedTitle}} ({{LinkedAuthor}}) - {{Description}}{{br/}}" nofollow=true]
You can also specify the link target too. For example…
[plugins_list format="{{LinkedTitle}} ({{LinkedAuthor}}) - {{Description}}{{br/}}" target="_blank"]
Truncate the Description
Two parameters exist to truncate the description, so it doesn’t get too long unwieldy. You can specify a maximum number of words or a maximum number of characters using words or chars. Here’s an example of each…
[plugins_list format="{{LinkedTitle}} ({{LinkedAuthor}}) - {{Description}}{{br/}}" words=20]
[plugins_list format="{{LinkedTitle}} ({{LinkedAuthor}}) - {{Description}}{{br/}}" chars=80]
You shouldn’t do this but if you specify both then the shortest one will be used.
By default, if a truncation occurs, ellipsis will be added to the end. However, you can change this by using the end parameter and specifying your own ending. For example…
[plugins_list format="{{LinkedTitle}} ({{LinkedAuthor}}) - {{Description}}{{br/}}" chars=80 end=" [More]"]
Remove Emoji
If you want to remove emoji from the description, use the emoji parameter to achieve this. By default this is true but set to false to have them removed. For example…
[plugins_list format="{{LinkedTitle}} ({{LinkedAuthor}}) - {{Description}}{{br/}}" emoji=false]
Sort by Author
Want so sort the output by author and not plugin name? Just use the parameter by_author. For example…
[plugins_list format="{{LinkedTitle}} ({{LinkedAuthor}}) - {{Description}}{{br/}}" by_author=true]
Cache
By default your plugin list will be cached for 5 minutes, ensuring that performance is impacted as little as possible. Use the parameter cache to change the number of minutes. Set this to false to switch off caching.
For example…
[plugins_list format="{{LinkedTitle}} ({{LinkedAuthor}}) - {{Description}}{{br/}}" cache=60]
This will cache for 1 hour. The following will switch the cache off…
[plugins_list format="{{LinkedTitle}} ({{LinkedAuthor}}) - {{Description}}{{br/}}" cache=false]
Using with the block editor
You can insert shortcodes directly into the block editor without an issue and it will be automatically added to a shortcode block. However, if you need to wrap HTML around it then this will cause issues. The solution here is to add a shortcode block first and then add the whole line into that. The HTML then works just fine.
Plugin Count
A shortcode also exists to allow you to display the number of plugins that you have. Simply add [plugins_number] to your post or page and it will return the number of active plugins.
To display the number of active AND inactive plugins use…
[plugins_number inactive=true]
You can also display the number of inactive plugins by specifying…
[plugins_number inactive=true active=false]
As with the other shortcode results will be cached by default. To change the number of minutes simply use the cache parameter. Set it to false to switch off caching. For example…
[plugins_number inactive=true cache=120]
This will set the cache to 2 hours.
Reviews & Mentions
A default WP credit page would be kind of neat
