[WordPress] 外掛分享: RC Site Map Plugin

首頁外掛目錄 › RC Site Map Plugin
WordPress 外掛 RC Site Map Plugin 的封面圖片
10+
安裝啟用
★★★★★
5/5 分(1 則評價)
46 天前
最後更新
問題解決
WordPress 4.6+ PHP 5.6+ v1.4 上架:2018-09-03

內容簡介

此外掛新增了一個 shortcode,可建立一個階層式網站地圖或特定文章列表,例如頁面、文章或自訂文章類型,每個列出的項目可以按下連結查看。該 shortcode 的名稱為:rc_sitemap。預設情況下,此 shortcode 會產生一個項目的無序列表,預設的類別為:"rc_sitemap_list"。可選的標題輸出預設的類別為:rc_sitemap_heading。

shortcode 概述

網站地圖 (rc_sitemap)

此 shortcode 用於取得和渲染一個已發布文章的清單,就像網站地圖一樣。以下是屬性:

post_type - 預設為 "page"。您可以使用 "post"、"page" 或任何文章類型的名稱。
orderby - 預設為 "menu_order"。用逗號分隔的選項清單,以排序:接受 "post_author"、"post_date"、"post_title"、"post_name","post_modified"、"post_modified_gmt"、"menu_order"、"post_parent"、"ID"、"rand" 或 "comment_count"。
order - 預設為 "ASC"。
heading_text - 預設為空,不顯示標題。
heading_tag - 預設為 "h2"。請注意,請勿包含大於/小於字符,僅包含字母數字字符,例如 p、h1、h2、h3 等。
heading_class - 預設為 'rc_sitemap_heading'。 CSS 類別新增至標題元素。
child_of - 預設為空。按 ID 只顯示單個頁面的子頁面。預設為 0(所有頁面)。請注意,僅適用於階層式文章類型。
depth - 預設為空。生成的清單中包括的頁面階層層數。接受 -1(任何深度)、0(所有頁面)、1(僅頂級頁面)和 n(到指定 n 深度的頁面)。
exclude - 預設為空。要排除的文章 ID 的逗號分隔清單。
include - 預設為空。要包含的文章 ID 的逗號分隔清單。
wrapper - 預設為 'ul'。清單的包裝元素。請注意,請勿包含大於/小於字符,僅包含字母數字字符,例如 ul、p 等。
wrapper_class - 預設為 'rc_sitemap_list'。CSS 類別新增至清單的包裝元素。

示範用法:

最基本的 shortcode 將會以遞增順序呈現一個 頁面 文章類型的項目清單,並在沒有列表標題的情況下轉換為無序 HTML 清單:

[rc_sitemap]

以下是具有自訂設置的進階用法範例,透過各種額外的屬性應用自訂設定:

[rc_sitemap post_type="your_cpt_name" orderby="date" order="DESC" heading_text="My CPT Title" heading_tag="h1" heading_class="my_custom_heading_class" wrapper="ul" wrapper_class="my_custom_wrapper_class"]

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.4) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「RC Site Map Plugin」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

This plugin adds a shortcode that will list a hierarchical site map or list of a particular type of post such as page, post or custom post types with clickable links to view each listed entry. The shortcode is registered using the name: rc_sitemap. The shortcode will by default render an unordered list of the entries with a default class of "rc_sitemap_list". The optional heading that it outputs has the default class of rc_sitemap_heading.
Overview of shortcode
Site map (rc_sitemap)
This shortcode is used to get and render a list of published posts like a site map. The attributes are as follows:

post_type – defaults to ‘page’. You can use ‘post’, ‘page’ or any post type name.
orderby – defaults to ‘menu_order’. Comma-separated list of options to sort by: accepts ‘post_author’, ‘post_date’, ‘post_title’, ‘post_name’, ‘post_modified’, ‘post_modified_gmt’, ‘menu_order’, ‘post_parent’, ‘ID’, ‘rand’, or ‘comment_count’.
order – defaults to ‘ASC’.
heading_text – defaults to empty, show no heading.
heading_tag – defaults to h2. Note, do not include greater than / less than characters, only the alphanumeric characters e.g. p, h1, h2, h3 etc.
heading_class – defaults to 'rc_sitemap_heading'. CSS Class added to the heading element.
child_of – defaults to empty. Display only the sub-pages of a single page by ID. Default 0 (all pages). Note, only works for hierarchical post types.
depth – defaults to empty. Number of levels in the hierarchy of pages to include in the generated list. Accepts -1 (any depth), 0 (all pages), 1 (top-level pages only), and n (pages to the given n depth).
exclude – defaults to empty. Comma-separated list of post IDs to exclude.
include – defaults to empty. Comma-separated list of post IDs to include.
wrapper – defaults to 'ul'. Wrapping element of the list. Note, do not include greater than / less than characters, only the alphanumeric characters e.g. ul, p etc.
wrapper_class – defaults to 'rc_sitemap_list'. CSS Class added to the wrapping element of the list.

Example usage:
The most basic shortcode will render a list of page post type entries as an unordered HTML list in ascending order with no list heading:
[rc_sitemap]

The following is an example of a more advanced usage with custom settings applied via the various additional attributes:
[rc_sitemap post_type="your_cpt_name" orderby="date" order="DESC" heading_text="My CPT Title" heading_tag="h1" heading_class="my_custom_heading_class" wrapper="ul" wrapper_class="my_custom_wrapper_class"]

延伸相關外掛

文章
Filter
Apply Filters
Mastodon