Version Description
Download this release
Release Info
Developer | simonwheatley |
Plugin | Custom Post Template |
Version | 1.3 |
Comparing to | |
See all releases |
Code changes from version 1.2 to 1.3
- custom-post-templates.php +14 -7
- locale/custom-post-template.pot +48 -0
- readme.txt +17 -2
- view/admin/select_post_template.php +26 -17
custom-post-templates.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Custom Post Templates
|
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/custom-post-template/
|
5 |
Description: 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.
|
6 |
Author: Simon Wheatley
|
7 |
-
Version: 1.
|
8 |
Author URI: http://simonwheatley.co.uk/wordpress/
|
9 |
*/
|
10 |
|
@@ -44,8 +44,8 @@ class CustomPostTemplates extends CustomPostTemplates_Plugin
|
|
44 |
// Init properties
|
45 |
$this->tpl_meta_key = 'custom_post_template';
|
46 |
// Init hooks and all that
|
47 |
-
$this->register_plugin ( 'post-templates', __FILE__ );
|
48 |
-
$this->add_meta_box( 'select_post_template', __('Post Template'), 'select_post_template', 'post', 'side', 'default' );
|
49 |
$this->add_action( 'save_post' );
|
50 |
$this->add_filter( 'single_template', 'filter_single_template' );
|
51 |
$this->add_filter( 'body_class' );
|
@@ -105,11 +105,18 @@ class CustomPostTemplates extends CustomPostTemplates_Plugin
|
|
105 |
|
106 |
$this->post_ID = $wp_query->post->ID;
|
107 |
|
|
|
108 |
$template_file = $this->get_custom_post_template();
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
|
114 |
return $template;
|
115 |
}
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/custom-post-template/
|
5 |
Description: 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.
|
6 |
Author: Simon Wheatley
|
7 |
+
Version: 1.3
|
8 |
Author URI: http://simonwheatley.co.uk/wordpress/
|
9 |
*/
|
10 |
|
44 |
// Init properties
|
45 |
$this->tpl_meta_key = 'custom_post_template';
|
46 |
// Init hooks and all that
|
47 |
+
$this->register_plugin ( 'custom-post-templates', __FILE__ );
|
48 |
+
$this->add_meta_box( 'select_post_template', __( 'Post Template', 'custom-post-templates' ), 'select_post_template', 'post', 'side', 'default' );
|
49 |
$this->add_action( 'save_post' );
|
50 |
$this->add_filter( 'single_template', 'filter_single_template' );
|
51 |
$this->add_filter( 'body_class' );
|
105 |
|
106 |
$this->post_ID = $wp_query->post->ID;
|
107 |
|
108 |
+
// No template? Nothing we can do.
|
109 |
$template_file = $this->get_custom_post_template();
|
110 |
+
|
111 |
+
if ( ! $template_file )
|
112 |
+
return $template;
|
113 |
+
|
114 |
+
// If there's a tpl in a (child theme or theme with no child)
|
115 |
+
if ( file_exists( trailingslashit( STYLESHEETPATH ) . $template_file ) )
|
116 |
+
return STYLESHEETPATH . DIRECTORY_SEPARATOR . $template_file;
|
117 |
+
// If there's a tpl in the parent of the current child theme
|
118 |
+
else if ( file_exists( TEMPLATEPATH . DIRECTORY_SEPARATOR . $template_file ) )
|
119 |
+
return TEMPLATEPATH . DIRECTORY_SEPARATOR . $template_file;
|
120 |
|
121 |
return $template;
|
122 |
}
|
locale/custom-post-template.pot
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation of the WordPress plugin by .
|
2 |
+
# Copyright (C) 2010
|
3 |
+
# This file is distributed under the same license as the package.
|
4 |
+
# FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
|
5 |
+
#
|
6 |
+
#, fuzzy
|
7 |
+
msgid ""
|
8 |
+
msgstr ""
|
9 |
+
"Project-Id-Version: \n"
|
10 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/custom-post-template\n"
|
11 |
+
"POT-Creation-Date: 2010-06-17 15:32+0000\n"
|
12 |
+
"PO-Revision-Date: 2010-MO-DA HO:MI+ZONE\n"
|
13 |
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
14 |
+
"Language-Team: LANGUAGE <LL@li.org>\n"
|
15 |
+
"MIME-Version: 1.0\n"
|
16 |
+
"Content-Type: text/plain; charset=utf-8\n"
|
17 |
+
"Content-Transfer-Encoding: 8bit\n"
|
18 |
+
|
19 |
+
#: custom-post-templates.php:48 view/admin/select_post_template.php:2
|
20 |
+
msgid "Post Template"
|
21 |
+
msgstr ""
|
22 |
+
|
23 |
+
#: plugin.php:660
|
24 |
+
msgid "How many widgets would you like?"
|
25 |
+
msgstr ""
|
26 |
+
|
27 |
+
#: plugin.php:667
|
28 |
+
msgid "Save"
|
29 |
+
msgstr ""
|
30 |
+
|
31 |
+
#: view/admin/select_post_template.php:13
|
32 |
+
msgid "Default Template"
|
33 |
+
msgstr ""
|
34 |
+
|
35 |
+
#: view/admin/select_post_template.php:25
|
36 |
+
#, php-format
|
37 |
+
msgid ""
|
38 |
+
"This theme has some <a href=\"%s\" target=\"_blank\">custom post templates</"
|
39 |
+
"a> that you can use to on individual posts, you can select one for this post "
|
40 |
+
"using the drop down above."
|
41 |
+
msgstr ""
|
42 |
+
|
43 |
+
#: view/admin/select_post_template.php:29
|
44 |
+
#, php-format
|
45 |
+
msgid ""
|
46 |
+
"This theme has no available <a href=\"%s\" target=\"_blank\">custom post "
|
47 |
+
"templates</a>."
|
48 |
+
msgstr ""
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: simonwheatley
|
|
3 |
Donate link: http://www.simonwheatley.co.uk/wordpress/
|
4 |
Tags: post, template, theme
|
5 |
Requires at least: 2.9
|
6 |
-
Tested up to:
|
7 |
-
Stable tag: 1.
|
8 |
|
9 |
Provides a drop-down to select different templates for posts from the post edit screen. The templates replace single.php for the specified post.
|
10 |
|
@@ -52,6 +52,21 @@ Right, that's it. Grump over. ;)
|
|
52 |
|
53 |
== Change Log ==
|
54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
= v1.2 2010/04/28 =
|
56 |
|
57 |
* ENHANCEMENT: Now sporting a conditional `is_post_template` function/template tag which is functionally equivalent to the core WordPress [is_page_template](http://codex.wordpress.org/Function_Reference/is_page_template) conditional function/template tag
|
3 |
Donate link: http://www.simonwheatley.co.uk/wordpress/
|
4 |
Tags: post, template, theme
|
5 |
Requires at least: 2.9
|
6 |
+
Tested up to: 3.0
|
7 |
+
Stable tag: 1.3
|
8 |
|
9 |
Provides a drop-down to select different templates for posts from the post edit screen. The templates replace single.php for the specified post.
|
10 |
|
52 |
|
53 |
== Change Log ==
|
54 |
|
55 |
+
= v1.3 2010/06/17 =
|
56 |
+
|
57 |
+
Dear Non-English Custom Post Template Users,
|
58 |
+
|
59 |
+
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.
|
60 |
+
|
61 |
+
Sorry it took so long.
|
62 |
+
|
63 |
+
Best regards,
|
64 |
+
|
65 |
+
Simon
|
66 |
+
|
67 |
+
* ENHANCEMENT: Now works with child themes, hat-tip Kathy
|
68 |
+
* LOCALISATION: Now ready for localisation!
|
69 |
+
|
70 |
= v1.2 2010/04/28 =
|
71 |
|
72 |
* ENHANCEMENT: Now sporting a conditional `is_post_template` function/template tag which is functionally equivalent to the core WordPress [is_page_template](http://codex.wordpress.org/Function_Reference/is_page_template) conditional function/template tag
|
view/admin/select_post_template.php
CHANGED
@@ -1,22 +1,31 @@
|
|
1 |
<?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?>
|
2 |
-
<label class="hidden" for="page_template"><?php _e( 'Post Template' ); ?></label>
|
3 |
-
|
4 |
-
|
5 |
-
<
|
6 |
-
|
7 |
-
<?php
|
8 |
-
if ( ! $custom_template ) {
|
9 |
-
echo "selected='selected'";
|
10 |
-
}
|
11 |
-
?>><?php _e( 'Default Template' ); ?></option>
|
12 |
-
<?php foreach( $templates AS $name => $filename ) { ?>
|
13 |
<option
|
14 |
-
value='
|
15 |
<?php
|
16 |
-
if ( $custom_template
|
17 |
echo "selected='selected'";
|
18 |
}
|
19 |
-
?>><?php
|
20 |
-
|
21 |
-
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?>
|
2 |
+
<label class="hidden" for="page_template"><?php _e( 'Post Template', 'custom-post-templates' ); ?></label>
|
3 |
+
<?php if ( $templates ) : ?>
|
4 |
+
|
5 |
+
<input type="hidden" name="custom_post_template_present" value="1" />
|
6 |
+
<select name="custom_post_template" id="custom_post_template">
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
<option
|
8 |
+
value='default'
|
9 |
<?php
|
10 |
+
if ( ! $custom_template ) {
|
11 |
echo "selected='selected'";
|
12 |
}
|
13 |
+
?>><?php _e( 'Default Template' ); ?></option>
|
14 |
+
<?php foreach( $templates AS $name => $filename ) { ?>
|
15 |
+
<option
|
16 |
+
value='<?php echo $filename; ?>'
|
17 |
+
<?php
|
18 |
+
if ( $custom_template == $filename ) {
|
19 |
+
echo "selected='selected'";
|
20 |
+
}
|
21 |
+
?>><?php echo $name; ?></option>
|
22 |
+
<?php } ?>
|
23 |
+
</select>
|
24 |
+
|
25 |
+
<p><?php printf( __( 'This theme has some <a href="%s" target="_blank">custom post templates</a> that you can use to on individual posts, you can select one for this post using the drop down above.', 'custom-post-templates' ), 'http://simonwheatley.co.uk/wordpress/custom-post-template/' ); ?></p>
|
26 |
+
|
27 |
+
<?php else : ?>
|
28 |
+
|
29 |
+
<p><?php printf( __( 'This theme has no available <a href="%s" target="_blank">custom post templates</a>.', 'custom-post-templates' ), 'http://simonwheatley.co.uk/wordpress/custom-post-template/' ); ?></p>
|
30 |
+
|
31 |
+
<?php endif; ?>
|