이 플러그인은 최근 3개의 주요 워드프레스 출시와 시험 되지 않았습니다. 워드프레스의 좀 더 최근 버전으로 이용할 때 더 이상 관리되지 않고 지원되지 않고 호환성 문제가 있을 수 있습니다.

Custom Post Template

설명

Provides a drop-down to select different templates for posts from the post edit screen. The templates are defined similarly to page templates, and will replace single.php for the specified post. This plugin will NOT switch the templates for the different posts in a listing page, e.g. a date or category archive, it will only affect the template used for single posts (i.e. you can choose a template which is not single.php).

Post templates, as far as this plugin is concerned, are configured similarly to page templates in that they have a particular style of PHP comment at the top of them. Each post template must contain the following, or similar, at the top:

<?php
/*
Template Name Posts: Snarfer
*/
?>

First note: Page templates use “Template Name:“, whereas post templates use “Template Name Posts:“.

Second note: You must have the custom post template files in your theme in the same directory/folder as your index.php template file, not in a sub-directory/sub-folder.

Developers

If you want to implement the custom post templates on a custom post type, you can use the cpt_post_types filter, here’s an example below of adding the custom post template selector and metabox to the “Movie” and “Actor” custom post types. This code can be added to a plugin or to the functions.php file in your theme.

/**
 * Hooks the WP cpt_post_types filter 
 *
 * @param array $post_types An array of post type names that the templates be used by
 * @return array The array of post type names that the templates be used by
 **/
function my_cpt_post_types( $post_types ) {
    $post_types[] = 'movie';
    $post_types[] = 'actor';
    return $post_types;
}
add_filter( 'cpt_post_types', 'my_cpt_post_types' );

설치

The plugin is simple to install:

  1. Download the plugin, it will arrive as a zip file
  2. Unzip it
  3. Upload custom-post-template directory to your WordPress Plugin directory
  4. Go to the plugin management page and enable the plugin
  5. Upload your post template files (see the Description for details on configuring these), and choose them through the new menu
  6. Give yourself a pat on the back

FAQ

Installation Instructions

The plugin is simple to install:

  1. Download the plugin, it will arrive as a zip file
  2. Unzip it
  3. Upload custom-post-template directory to your WordPress Plugin directory
  4. Go to the plugin management page and enable the plugin
  5. Upload your post template files (see the Description for details on configuring these), and choose them through the new menu
  6. Give yourself a pat on the back
I get an error like this: Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /web/wp-content/plugins/custom-post-template/custom-post-templates.php

This is because your server is running PHP4. Please see “Other Notes > PHP4” for more information.

후기

2018년 2월 15일
This plugin works so well I forget we're using it. We've got a few different post templates depending on the content we have, and this plugin makes it easy to choose the right one. I wish it worked for archive pages too!
2021년 3월 19일
So many years this plugin worked like a charm for many custom templates Now it looks like its finally gone . Thanks for this great Plugin. This (was) a must-have Plugin, even after getting old it still works like a charm
2017년 1월 7일
I was a little hesitant to install a plugin that hasn't been updated for this long, but it works perfect. Quick and easy to set up.
2016년 11월 2일
amazing.. The best plugin if you want to create different design for every landing pages.
2016년 9월 3일
It works great for me. Even after such a long time of not being maintained. Thank you for this plugin.
모든 44 평가 읽기

기여자 & 개발자

“Custom Post Template”(은)는 오픈 소스 소프트웨어입니다. 다음의 사람들이 이 플러그인에 기여하였습니다.

기여자

자국어로 “Custom Post Template”(을)를 번역하세요.

개발에 관심이 있으십니까?

코드 탐색하기는, SVN 저장소를 확인하시거나, 개발 기록RSS로 구독하세요.

변경이력

v1.5 2012/06/14

This upgrade REQUIRES WordPress version 3.4 and WILL NOT WORK WITHOUT IT.

  • Updated for compatibility with 3.4, takes advantage of the new WP_Theme class and methods and the get_file_data function.

v1.4 2011/08/14

  • Added a filter, cpt_post_types, so people can choose which post types this plugin shows the UI for
  • Linked to WP.org, not my site, for documentation (quicker to load)

v1.3 2010/06/17

Dear Non-English Custom Post Template Users,

This release includes the facility for Custom Post Template to be translated into languages other than English. Please contact me if you want to translate Custom Post Template into your language.

Sorry it took so long.

  • ENHANCEMENT: Now works with child themes, hat-tip Kathy
  • LOCALISATION: Now ready for localisation!

v1.2 2010/04/28

  • ENHANCEMENT: Now sporting a conditional is_post_template function/template tag which is functionally equivalent to the core WordPress is_page_template conditional function/template tag
  • ENHANCEMENT: If the theme uses the core WordPress (body_class)[https://codex.wordpress.org/Template_Tags/body_class] template tag, then you will have two new classes added: “post-template” and “post-template-my-post-template-php” (where your post template file is named “my-post-template.php”).

v1.1 2010/01/27

  • IDIOTFIX: Managed to revert to an old version somehow, this version should fix that.

v1 2010/01/15 (released 2010/01/26)

  • BUGFIX: Theme templates now come with a complete filepath, so no need to add WP_CONTENT_DIR constant to the beginning.
  • ENHANCEMENT: Metabox now shows up on the side, under the publish box… where you’d expect.
  • Plugin initially produced on behalf of Words & Pictures.

v0.9b 2008/11/26

  • Plugin first released

v0.91b 2008/11/28

  • BUGFIX: The plugin was breaking posts using the “default” template, this is now fixed. Apologies for the inconvenience.
  • Tested up to WordPress 2.7-beta3-9922

v0.91b 2008/11/28

  • BUGFIX: The plugin was breaking posts using the “default” template, this is now fixed. Apologies for the inconvenience.
  • Tested up to WordPress 2.7-beta3-9922* Tested up to WordPress 2.7-beta3-9922

v0.92b 2008/12/04

  • Minor code tweaks
  • Blocked direct access to templates