Title: Custom Post Template
Author: Simon Wheatley
Published: <strong>27 نوامبر 2008</strong>
Last modified: 14 ژوئن 2012

---

جستجوی افزونه‌ها

This plugin **hasn’t been tested with the latest 3 major releases of WordPress**.
It may no longer be maintained or supported and may have compatibility issues when
used with more recent versions of WordPress.

![](https://s.w.org/plugins/geopattern-icon/custom-post-template.svg)

# Custom Post Template

 توسط [Simon Wheatley](https://profiles.wordpress.org/simonwheatley/)

[دانلود](https://downloads.wordpress.org/plugin/custom-post-template.zip)

 * [جزئیات](https://fa.wordpress.org/plugins/custom-post-template/#description)
 * [نقد و بررسی‌ها](https://fa.wordpress.org/plugins/custom-post-template/#reviews)
 *  [نصب](https://fa.wordpress.org/plugins/custom-post-template/#installation)
 * [توسعه](https://fa.wordpress.org/plugins/custom-post-template/#developers)

 [پشتیبانی](https://wordpress.org/support/plugin/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](https://codex.wordpress.org/Pages#Creating_Your_Own_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

## سوالات متداول

  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.

## نقد و بررسی‌ها

![](https://secure.gravatar.com/avatar/41184eff6911930093f029452b1874d6a6a5913c38334076d340dbdd6d2d2491?
s=60&d=retro&r=g)

### 󠀁[5 years of working right](https://wordpress.org/support/topic/5-years-of-working-right/)󠁿

 [willwenzel](https://profiles.wordpress.org/willwenzel/) 15 فوریه 2018

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!

![](https://secure.gravatar.com/avatar/9c7be41168a828b3275c2a320c1b629708f7a7af499541029a40e662b9320a3e?
s=60&d=retro&r=g)

### 󠀁[Forever sleep well , sundown 2021](https://wordpress.org/support/topic/must-have-353/)󠁿

 [metaeditor](https://profiles.wordpress.org/metaeditor/) 19 مارس 2021

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

![](https://secure.gravatar.com/avatar/6c68416aa7032cc018e7494a5b389ac21d1362a3fe2bbad7c2d76d1504e40f2e?
s=60&d=retro&r=g)

### 󠀁[Perfect](https://wordpress.org/support/topic/perfect-3460/)󠁿

 [lh822184](https://profiles.wordpress.org/lh822184/) 7 ژانویه 2017

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.

![](https://secure.gravatar.com/avatar/4b2d6d9af422d35388d1aaaea39f61c694b56714bd7a4edbc11442b741960e09?
s=60&d=retro&r=g)

### 󠀁[Still working](https://wordpress.org/support/topic/still-working-46/)󠁿

 [Glenn](https://profiles.wordpress.org/layoutph/) 2 نوامبر 2016

amazing.. The best plugin if you want to create different design for every landing
pages.

![](https://secure.gravatar.com/avatar/8e792f09f5a869b4afbfd980fb3d49aeae9a41c0f545717f64fbf7440bd5ef91?
s=60&d=retro&r=g)

### 󠀁[Good job!](https://wordpress.org/support/topic/good-job-549/)󠁿

 [Filip Albert](https://profiles.wordpress.org/alberfil/) 3 سپتامبر 2016

It works great for me. Even after such a long time of not being maintained. Thank
you for this plugin.

![](https://secure.gravatar.com/avatar/3f5e299fcec80dd59f3076e15e2dcb23ddb4b34530a6b894d7ac0d4d687b7391?
s=60&d=retro&r=g)

### 󠀁[Still Great](https://wordpress.org/support/topic/still-great-2/)󠁿

 [KevinX](https://profiles.wordpress.org/designcat/) 3 سپتامبر 2016

Easy to use and on most of my pages =)

 [ خواندن تمامی 44 نقد و بررسی‌ ](https://wordpress.org/support/plugin/custom-post-template/reviews/)

## توسعه دهندگان و همکاران

“Custom Post Template” نرم افزار متن باز است. افراد زیر در این افزونه مشارکت کرده‌اند.

مشارکت کنندگان

 *   [ Simon Wheatley ](https://profiles.wordpress.org/simonwheatley/)

[ترجمه “Custom Post Template” به زبان شما.](https://translate.wordpress.org/projects/wp-plugins/custom-post-template)

### علاقه‌ مند به توسعه هستید؟

[Browse the code](https://plugins.trac.wordpress.org/browser/custom-post-template/),
check out the [SVN repository](https://plugins.svn.wordpress.org/custom-post-template/),
or subscribe to the [development log](https://plugins.trac.wordpress.org/log/custom-post-template/)
by [RSS](https://plugins.trac.wordpress.org/log/custom-post-template/?limit=100&mode=stop_on_copy&format=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](http://www.simonwheatley.co.uk/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](https://codex.wordpress.org/Function_Reference/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](http://www.wordsandpics.co.uk/).

#### 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

## اطلاعات

 *  نگارش **1.5**
 *  Last updated **8 سال پیش**
 *  نصب‌های فعال **10,000+**
 *  نگارش وردپرس ** 3.4 یا بالاتر **
 *  Tested up to **3.4.2**
 *  زبان
 * [English (US)](https://wordpress.org/plugins/custom-post-template/)
 * Tags
 * [post](https://fa.wordpress.org/plugins/tags/post/)[template](https://fa.wordpress.org/plugins/tags/template/)
   [theme](https://fa.wordpress.org/plugins/tags/theme/)
 *  [نمایش پیشرفته](https://fa.wordpress.org/plugins/custom-post-template/advanced/)

## امتیازها

 4.8 از 5 ستاره.

 *  [  امتیاز 39 5-ستاره     ](https://wordpress.org/support/plugin/custom-post-template/reviews/?filter=5)
 *  [  امتیاز 2 4-ستاره     ](https://wordpress.org/support/plugin/custom-post-template/reviews/?filter=4)
 *  [  امتیاز 0 3-ستاره     ](https://wordpress.org/support/plugin/custom-post-template/reviews/?filter=3)
 *  [  امتیاز 1 2-ستاره     ](https://wordpress.org/support/plugin/custom-post-template/reviews/?filter=2)
 *  [  امتیاز 1 1-ستاره     ](https://wordpress.org/support/plugin/custom-post-template/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/custom-post-template/reviews/#new-post)

[مشاهده همه بررسی‌ها](https://wordpress.org/support/plugin/custom-post-template/reviews/)

## مشارکت کنندگان

 *   [ Simon Wheatley ](https://profiles.wordpress.org/simonwheatley/)

## پشتیبانی

چیزی برای گفتن دارید؟ نیاز به کمک دارید؟

 [مشاهده انجمن پشتیبانی](https://wordpress.org/support/plugin/custom-post-template/)

## کمک مالی

آیا تمایل دارید از پیشرفت این افزونه حمایت کنید؟

 [ کمک مالی به این افزونه ](http://www.simonwheatley.co.uk/wordpress/)