這個外掛並未在最新的 3 個 WordPress 主要版本上進行測試。開發者可能不再對這個外掛進行維護或提供技術支援,並可能會與更新版本的 WordPress 產生使用上的相容性問題。

Default Theme Pages

描述

This plugin is intended to be useful for template developers

New in version 0.4

  • added ‘object’ (page object) in every $default_theme_pages item for fast access.
  • added all default pages to wp toolbar, inside ‘site name’, to increase user experience.

How to use

Add this code in your functions.php.

global $default_theme_pages;
$default_theme_pages = array(
    array(
        'name' => 'home',               // initial slug page / id for templating - access functions
        'title' => 'Homepage',          // page title
        'option' => 'page_on_front',    // option page id ( stores the page id in an option, use only in theese cases)
        'description' => 'homepage'     // description
    ),
    array(
        'name' => 'blog',
        'title' => 'Blog',
        'option' => 'page_for_posts',
        'description' => 'blog'
    ),
    array(
        'name' => 'contact',
        'title' => 'Contact me!',
        'description' => 'Contact form page'
    )
 );

Tips

  • After the pages are created automatically, you can change their title and slug without problem.
  • If you add an option names: page_on_front and page_for_posts, you will block the home-page and the blog-page on your site.

Templating

You can template using ID or name (setted up in $default_theme_pages global variable ), something like:

page-131.php or page-contact.php (If you change the page slug, this will still work because ‘contact’ was defined as pagename if $default_theme_pages global variable).

For detect if you’re in that page:

dtp_is_page('contact')

Getting a default page id:

$page_id = dtp_get_page_id('contact');

This method is more quick than get_page_by_path because page ID is stored on global variable.

螢幕截圖

  • Admin pages list

評價

There are no reviews for this plugin.

貢獻者及開發者

“Default Theme Pages” 是一個開源的軟體。以下的人對這個外掛作出了貢獻。

貢獻者

將 Default Theme Pages 外掛本地化為台灣繁體中文版。

對開發相關資訊感興趣?

任何人均可瀏覽程式碼、查看 SVN 存放庫,或透過 RSS 訂閱開發記錄

修改日誌

0.4

  • added ‘object’ (page object) in every $default_theme_pages item for fast access.
  • added all default pages to wp toolbar, inside ‘site name’, to increase user experience.

0.3

  • changed stored system to gain performance
  • added ‘id’ in every $default_theme_pages item for fast use
  • added some accessible functions: dtp_is_page, dtp_get_page_id
  • added default pages in template system, now you can template a default page as: page-name.php

0.2

  • blocked status modifications
  • blocked move to trash

0.1

  • Initial release