內容簡介
這個 WordPress 外掛能夠讓使用者輕易地列出一個特定文章或頁面中所有相關的附加檔案。例如,如果您想要建立一個長列表,列出多個Word文件或PDF文件,您只需要將它們附加到頁面或文章上,然後插入 shortcode 到您想放置列表的地方。
使用方式
使用這個外掛的最簡單方式就是直接使用 shortcode。預設情況下,列表會以最新上傳的附件在列表頂端,而最老的會在列表底部。列表上方不會有標題。列表會以無序的方式建立,並以 CSS 類別 "attachment-list" 來命名。
[list-attachments]
選項
type - 這是一個逗號分隔的檔案副檔名列表,用於包含在列表中的檔案副檔名。如果留空,則所有附件都會被包括在內
orderby - 可與 WordPress query_posts() 函數一起使用的值之一
order - 指定列表是按升序還是降序排列
groupby - 如果您想要將列表分割成特定的群組,您可以將某個 WordPress 文章對象參數指定為此屬性的值。例如,您可以將常見的 "description" 用於附件,以將其組織成群組。在這種情況下,您將使用 "post_content" 作為此 shortcode 的 "groupby" 參數。
before_list - 任何您希望在列表開始之前出現的 HTML 代碼
opening - 列表的開始標籤(預設為<ul class=”attachment-list”>)
closing - 列表的結束標籤(預設為</ul>)
before_item - 列表中每個項目的開始標籤(預設為<li>)
after_item - 列表中每個項目的結束標籤(預設為</li>)
這是這個外掛的第一個版本,因此肯定還有很多需要添加的功能和需要解決的問題。如果您使用這個外掛並有任何建議或問題,請在該帖子中發表評論讓我們知道。
已知問題
HTML 代碼參數(before_list、after_list、before_item、after_item 等)僅在透過視覺編輯器添加時有效。在透過 HTML 編輯器添加時,它們無法正確地通過 shortcode 進行傳送。
待辦事項
重新編寫處理 HTML 代碼參數的方法
刪除外掛中的一些硬編碼 HTML 元素,並使它們可通過 shortcode 參數進行設置
添加一個小工具到該外掛
外掛標籤
開發者團隊
原文外掛簡介
This WordPress plug-in allows users to easily list all of the attachments associated with a specific post or page within WordPress. For instance, if you want to create a long list of Word documents or PDF documents, you can simply attach them to the page or post, then insert the shortcode where you’d like that list to appear.
Usage
The simplest way to use this plug-in is just to use the shortcode. That will, by default, list the attachments with the most recent upload at the top of the list and the oldest upload at the end of the list. No heading will be included above the list. The list will be created as an unordered list with the CSS class of “attachment-list”.
[list-attachments]
Options
type – a comma-separated list of file extensions that should be included in the list. If this is left empty, all attachments will be included
orderby – any of the values that can be used with the WordPress query_posts() function
order – indicate whether the list should be sorted in ascending or descending order
groupby – if you would like the list split into specific groups, you can indicate any of the WordPress post object parameters as the value of this property. For instance, you can use a common “description” for your attachments to organize them into groups. In that case, you would use “post_content” as the “groupby” parameter for this shortcode
before_list – any HTML code you want to appear before the list begins
opening – the opening tag(s) for the list (defaults to
)
before_item – the opening tag(s) for each item of the list (defaults to
after_item – the closing tag(s) for each item of the list (defaults to
)
This is the first version of this plug-in, so I’m certain there are a lot of features that still need to be added and bugs that need to be worked out. If you try out the plug-in and have any suggestions or notice any issues, please comment on this post and let us know.
Known Issues
The HTML code arguments (before_list, after_list, before_item, after_item, etc.) only work when added through the visual editor. When added through the HTML editor, they are not sent properly through the shortcode.
To Do
Re-do the method of handling the HTML code arguments
Remove the handful of hard-coded HTML elements that are in the plug-in, making them configurable through shortcode arguments
Add a widget to the plugin
