內容簡介
此外掛可讓編輯者建立一個「人員頁面」,顯示選定的網站使用者列表,包括照片、簡介、職位、個人資訊、網站連結等等。啟用插件後,透過頁面模板,插件會創建一個拖放的元框,編輯者可以使用它來選擇使用者並建立標題,這些使用者和標題則會顯示在人員頁面模板上,適用時還會顯示全面的個人資訊連結。
此外掛還在「使用者編輯」管理介面上建立自訂的「職稱」和「照片」欄位,可用於主題頁面,同時還支援「使用者照片」和 gravatar 圖示。
此外掛包含了「Twenty Twelve」和「Twenty Thirteen」兩個主題的三個範本檔案,位於 /theme-templates/ 目錄下:
- people-page.php 用於顯示人員頁面索引列表
- author.php 用於顯示單一使用者資訊頁面
- people-page.css 包含基本人員頁面樣式,可自訂
詳細的使用說明和注意事項,請參閱「其他注意事項」。
需求主題檔案:安裝此外掛後,必須在您的佈景主題資料夾中建立一個「people-page.php」頁面模板,才可使用此外掛。插件的預設範本(基於 Twenty Twelve 和 Twenty Thirteen 主題)位於插件的 /theme-templates/ 目錄中。如果要使用此範本,請將它複製到您的佈景主題目錄中。您也可以從您網站的佈景主題建立自訂模板:
1. 複製您的佈景主題資料夾中的「page.php」檔案,並將它重新命名為「people-page.php」。
2. 在第一個 PHP 標籤直接後面,輸入以下註解:「/* Template Name: People Page */」,將您的新頁面指定為範本。
3. 在 WordPress 迴圈之後(或任何您想要顯示的位置)插入人員頁面索引功能。
「摘要長度引數」(整數,可省略):設定「簡介資訊」採用的字元限制。預設值為 420。
每個「theme-templates」子目錄中都可以找到包含基本樣式的 CSS 樣式表「people-page.css」,將它複製到您的佈景主題目錄中,即可以套用預設樣式。這個檔案中的樣式可以根據您的主題進行修改。
您可能還要自訂您的佈景主題的「author.php」模板,用於顯示使用者的個人資訊。「theme-templates」中包含了基於 Twenty Twelve 主題的範本檔案。要使用您佈景主題現有的「author.php」檔案,只需在 WordPress 迴圈後(或任何您想要顯示的位置)插入人員頁面作者功能:
<?php echo people_page_author(); ?>
人員頁面的資料儲存在使用者 ID 和標題字串的陣列中,您可以使用 get_post_meta() 直接存取此陣列:
<?php $people = get_post_meta( $post->ID, 'peeps', true ); ?>
使用此外掛:啟用此外掛後,將頁面的範本設為「People Page」,並更新頁面。現在,您應該在中央欄位看到人員頁面元框。使用這個區域來選擇和排列使用者,如有需要則建立標題。
此外掛還提供了額外的使用者編輯/個人資訊欄位:啟用插件後,在「編輯使用者」管理頁面底部添加了「職稱」和「照片」欄位(選擇性)。如果設置了這些欄位,它們會包含在人員頁面顯示中。如果沒有設置照片,此外掛就會從其他插件中獲取使用者圖示。
外掛標籤
開發者團隊
原文外掛簡介
This plugin allows editors to create a “People Page” that displays a list of selected site users with photos, bios, titles, profile and website links and more.
When activated via a page template, the plugin creates a drag and drop meta box which editors can use to select users and create headers. These users are listed on the people page template, along with links to their full profile when applicable.
The plugin also creates custom “Title” and “Photo” fields on the “User Edit” admin screen, which are used in theme pages. The plugin also supports “User Photo” plugin images and gravatars.
Three template files for both the “Twenty Twelve” and “Twenty Thirteen” themes are included within the /theme-templates/ directory:
“people-page.php” displays the people page index list
“author.php” displays a single user’s info page
“people-page.css” contains basic people page styles for each theme; this file can be customized
See “Other Notes” for more details and usage instructions.
Required Theme Files
After installation a “people-page.php” template must be created inside your theme’s folder in order to use the plugin. Default templates (based on the Twenty Twelve and Twenty Thirteen themes) are included inside the plugin’s ‘theme-templates’ directory. Copy this file to your theme’s directory if you wish to use it. You can also create a custom template from your site’s theme:
Duplicate the “page.php” file in your theme’s folder and rename it “people-page.php”
Assign your new page as a template by entering the following comment directly after the first php tag: /* Template Name: People Page */
Insert the people page index function after the WordPress loop (or wherever you’d like it to appear):
Excerpt Length Argument (integer, optional): Set the character limit where “Biographical Info” will be excerpted. Default = 420.
A CSS stylesheet “people-page.css” that contains basic styles can be found in each of the ‘theme-templates’ subdirectories. Copy it into your theme’s directory to apply the default styles. The styles in this file can be altered to better match your theme.
You may also wish to customize your theme’s “author.php” template, which is used to display users’ profiles. A sample “author.php” file (based on the Twenty Twelve theme) is included in the ‘theme-templates’. To use your theme’s existing “author.php” file, insert the people page author function after the loop (or wherever you’d like it to appear):
The people page data is stored as an array of user IDs and heading strings. You can access this array directly in your theme using get_post_meta():
ID, 'peeps', true ); ?>
Using the Plugin
To activate the plugin, set a page’s template to use the “People Page” template and update the page. You should now see the people page meta box in the center column. Use this area to select and arrange users and create section headings if desired.
Additional User Edit / Profile Fields
“Title” and “Photo” fields (optional) are added to the bottom of the “Edit User” admin page when the plugin is activated. When set these fields are included in people page displays. If a photo is not set the plugin will attempt to display 1) a photo set using the “User Photo” plugin or 2) a gravatar. Gravatar size is 150 pixels by default.
Default Displays
People Page
Photo (if set; if not set and available: “User Photo” image; gravatar)
Name (linked if “Biographical Info” field is excerpted)
Title (if set)
[ posts | website ] (links if: User has posts (to profile) | website if field is set)
Biographical Info (includes link to profile if text is excerpted)
Author Page
Photo (if set; if not set and available: “User Photo” image; gravatar)
Name
Title (if set)
[ website ] (if set)
Biographical Info
Posts (last three; post details: date, and excerpt – if set: comment number, category, tags)
