前言介紹
- 這款 WordPress 外掛「Content Sectioner」是 2016-09-02 上架。
- 目前有 10 個安裝啟用數。
- 上一次更新是 2016-09-03,距離現在已有 3165 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
- 外掛最低要求 WordPress 3.1.0 以上版本才可以安裝。
- 尚未有人給過這款外掛評分。
- 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。
外掛協作開發者
外掛標籤
developer | content filtering | Content Formatting |
內容簡介
ng between the first occurrence of an h3 tag and the next occurrence of an h2 tag on the About page. Use these tags to mark the beginning and end of the inset section.");
Content authors will then be able to refer to these instructions while editing the content of the About page.
原文外掛簡介
Most modern websites have pages that break the content into multiple sections, with changing background colors and graphics marking the breaks between sections. In order for a page to be broken into sections, typically there needs to be additional markup within the HTML (ie. div tags) that can be targeted in the stylesheet for formatting. However, most content authors don’t want to think about techie stuff like div tags, and prefer to work in the Visual editor which only provides for semantic markup (“Paragraph”, “Heading 1”, etc.).
Content Sectioner takes advantage of WordPress’s content filtering mechanism and makes it easy for a theme developer to insert the necessary sectioning markup auto-magically while allowing content authors to still work as they prefer. It looks for specified landmarks within the content (such as h3 tags) and performs the necessary code insertions or replacements. It does this using a concise and easy-to-use notation, relieving the theme developer from having to write (often repetitive) regular expressions and string manipulation.
A concrete example
Suppose you’re working on a site and you want the About page (with slug about) to have an inset in the middle of it with a blue background setting it apart. The inset should contain the first occurence of a “Heading 3” and all the paragraphs up until just before the next “Heading 2”. The stylesheet will apply the changing background to elements with the selector .inset.
Assuming your index.php file contains something like this:
post_name;
get_template_part('content', $current_slug);
?>
Then in the file content-about.php, you can set up the Content Sectioner like so:
replace_first(
array(
'open_tag' => 'h3',
'open_insert' => '
'open_policy' => 'before',
'close_tag' => 'h2',
'close_insert' => '
',
'close_policy' => 'before'
)
);
// Do the usual Loop thing here...
?>
The About page (and only the About page) will have this inset section inserted.
You can provide replacement rules that replace/insert at the first occurrence of a match, the next occurrence, all remaining occurrences, or all occurrences in the entire piece of content. You can place the inserted HTML before or after a match, or replace the match. Also, you can match a closing tag by simply providing the preceding slash character (eg. ‘/h2’). Tag matches will match against any variant of a tag (upper or lowercase, with or without attributes, as an opening tag or as a self-closing tag like
). In the rare case that something other than a tag needs to be matched, you can supply a raw regex instead of a tag.
Providing instructions
As the theme developer, you likely would want to let the content authors know that this magic insertion of sections will occur, and what landmarks need to be present in their content to trigger the sectioning.
In some file in your theme that gets loaded for every page (most likely functions.php), you can provide such instructions along with the slug for the page to which the instructions apply. The instructions will appear at the top of the Edit Page page in the admin.
ContentSectioner::provide_instructions('about', "
A blue background will be placed behind everything starting at the first Heading 3
through just before the next Heading 2.");
Full User Guide
For full documentation and more sample use cases, visit the Content Sectioner homepage.
各版本下載點
- 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
- 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Content Sectioner」來進行安裝。
(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。
1.0.0 |
延伸相關外掛(你可能也想知道)
Manage Tags 》
,總結:
,這是一個簡單的外掛程式,允許使用者將標籤顯示為篩選器,以輕鬆過濾內容。使用此外掛程式的目標是...。