[WordPress] 外掛分享: Child Pages Shortcode

首頁外掛目錄 › Child Pages Shortcode
WordPress 外掛 Child Pages Shortcode 的封面圖片
5,000+
安裝啟用
★★★★
4.6/5 分(20 則評價)
3031 天前
最後更新
問題解決
WordPress 3.8+ v1.9.3 上架:2011-10-10

內容簡介

您可以使用簡短代碼來從頁面中顯示子頁面。

此外掛在 GitHub 上維護。

一些功能

此外掛將添加簡碼[child_pages]顯示子頁面。
您可以自定義插件上的默認HTML模板。
此外掛將能夠對頁面進行“節錄”。

範例

顯示當前頁面的子頁面。
[child_pages width=”33%”]

引數

id - 頁面ID(可選)
size - 文章縮略圖大小,例如“縮略圖”或“大”
width - 子頁面塊的寬度。
disable_shortcode - 如果設為 true,則簡碼在模板中不起作用。
disable_excerpt_filters - 如果設為 true,則節選的過濾器不起作用。

篩選器 hooks 範例

用於 query_posts() 查詢的篩選器。

<?php
//默認引數
$args = array(
'post_status' => 'publish',
'post_type' => 'page',
'post_parent' => $id_for_the_post,
'orderby' => 'menu_order',
'order' => 'ASC',
'nopaging' => true,
);

add_filters('child-pages-shortcode-query', "my_query");
function my_query($args) {
//
//某些代碼在此
//
return $args;
}
?>

用於默認模板的篩選器。

<?php
add_filter("child-pages-shortcode-template", "my_template");
function my_template($template) {
return '<div class="%class%"><a href="%post_url%">%post_thumb%</a></div>';
}
?>

用於樣式表 URI 的篩選器。

<?php
add_filter("child-pages-shortcode-stylesheet", "my_style");
function my_style($url) {
return 'http://example.com/path/to/style.css';
}
?>

默認模板

<div id="child_page-%post_id%" class="child_page" style="width:%width%;">
<div class="child_page-container">
<div class="post_thumb"><a href="%post_url%">%post_thumb%</a></div>
<div class="post_content">
<h4><a href="%post_url%">%post_title%</a></h4>
<div class="post_excerpt">%post_excerpt%</div>
</div>
</div>
</div>

模板變數

%post_id% - 頁面的 ID
%width% - 單個頁面的塊的寬度
%post_url% - 頁面固定鏈接
%post_thumb% - 文章縮略圖
%post_title% - 頁面標題
%post_excerpt% - 頁面節錄

支援

http://wpist.me/wp/child-pages-shortcode/(英文)
http://firegoby.theta.ne.jp/wp/child-pages-shortcode(日文)

貢獻者

Takayuki Miyauchi

學分

使用本插件不保證,但無論用途如何,WordPress 的用戶可以免費使用此插件。
作者必須事先承認在使用此插件時不保證操作保證和支援。

聯繫

http://wpist.me/

外掛標籤

開發者團隊

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

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

原文外掛簡介

You can use shortcode for display child pages from the page.
This plugin maintained on GitHub.
Some features

This plugin will add shortcode [child_pages] display child pages.
You can customize default HTML template on your plugin.
This plugin will be able to “excerpt” to the pages.

Example
Display child pages of the current page.
[child_pages width=”33%”]
Args

id – ID of page (Optional)
size – Post thumbnail size. e.g. ‘thumbnail’ or ‘large’
width – width of block for child pages.
disable_shortcode – Shortcode not work in the template if set true.
disable_excerpt_filters – filters not work for the excerpt if set true.

filter hooks example
Filter for query_posts() query.
'publish',
'post_type' => 'page',
'post_parent' => $id_for_the_post,
'orderby' => 'menu_order',
'order' => 'ASC',
'nopaging' => true,
);

add_filters('child-pages-shortcode-query', "my_query");
function my_query($args) {
//
// some code here
//
return $args;
}
?>

Filter for default template.
%post_thumb%

';
}
?>

Filter for stylesheet URI.

Default Template

%post_thumb%

%post_title%

%post_excerpt%

Template valiables

%post_id% – ID of the Page
%width% – Width of block for single page
%post_url% – Page permalink
%post_thumb% – for Post thubmail
%post_title% – Page title
%post_excerpt% – Page excerpt

Support

http://wpist.me/wp/child-pages-shortcode/ (en)
http://firegoby.theta.ne.jp/wp/child-pages-shortcode (ja)

Contributors

Takayuki Miyauchi

Credits
This plug-in is not guaranteed though the user of WordPress can freely use this plug-in free of charge regardless of the purpose.
The author must acknowledge the thing that the operation guarantee and the support in this plug-in use are not done at all beforehand.
Contact

http://wpist.me/
@wpist_me

延伸相關外掛

文章
Filter
Mastodon