Version Description
- Use medial modal instead of thickbox for WordPress 3.5+ (props mparolisi).
- Fix getting plugin directory name for il8n (props pixeltechnologies).
Download this release
Release Info
Developer | chrisscott |
Plugin | Multiple Post Thumbnails |
Version | 1.6 |
Comparing to | |
See all releases |
Code changes from version 1.6.1 to 1.6
- multi-post-thumbnails.php +1 -8
- readme.txt +101 -10
multi-post-thumbnails.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Multiple Post Thumbnails
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/multiple-post-thumbnails/
|
5 |
Description: Adds the ability to add multiple post thumbnails to a post type.
|
6 |
-
Version: 1.6
|
7 |
Author: Chris Scott
|
8 |
Author URI: http://voceplatforms.com/
|
9 |
*/
|
@@ -223,13 +223,6 @@ if (!class_exists('MultiPostThumbnails')) {
|
|
223 |
return $protected;
|
224 |
}
|
225 |
|
226 |
-
/**
|
227 |
-
* allow the plugin to be in the plugins directory or the theme directory
|
228 |
-
*
|
229 |
-
* @param string $relative_path Relative file path to the plugin file to get the URL of
|
230 |
-
* @param string $plugin_path Absolute file path to the plugin base directory
|
231 |
-
* @return string the URL of the plugin file
|
232 |
-
*/
|
233 |
private function plugins_url($relative_path, $plugin_path) {
|
234 |
$template_dir = get_template_directory();
|
235 |
|
3 |
Plugin Name: Multiple Post Thumbnails
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/multiple-post-thumbnails/
|
5 |
Description: Adds the ability to add multiple post thumbnails to a post type.
|
6 |
+
Version: 1.6
|
7 |
Author: Chris Scott
|
8 |
Author URI: http://voceplatforms.com/
|
9 |
*/
|
223 |
return $protected;
|
224 |
}
|
225 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
226 |
private function plugins_url($relative_path, $plugin_path) {
|
227 |
$template_dir = get_template_directory();
|
228 |
|
readme.txt
CHANGED
@@ -3,24 +3,103 @@ Contributors: chrisscott, voceplatforms
|
|
3 |
Tags: thumbnails, image, featured image
|
4 |
Requires at least: 2.9.2
|
5 |
Tested up to: 3.9.1
|
6 |
-
Stable tag: 1.6
|
7 |
-
License: GPLv2 or later
|
8 |
-
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
10 |
Adds multiple post thumbnails to a post type. If you've ever wanted more than one Featured Image on a post, this plugin is for you.
|
11 |
|
12 |
== Installation ==
|
13 |
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
== Frequently Asked Questions ==
|
17 |
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
-
|
22 |
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
== Screenshots ==
|
26 |
|
@@ -30,9 +109,21 @@ See Frequently Asked Questions at https://github.com/voceconnect/multi-post-thum
|
|
30 |
|
31 |
== Changelog ==
|
32 |
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
-
|
36 |
|
37 |
= 1.3 =
|
38 |
|
3 |
Tags: thumbnails, image, featured image
|
4 |
Requires at least: 2.9.2
|
5 |
Tested up to: 3.9.1
|
6 |
+
Stable tag: 1.6
|
|
|
|
|
7 |
|
8 |
Adds multiple post thumbnails to a post type. If you've ever wanted more than one Featured Image on a post, this plugin is for you.
|
9 |
|
10 |
== Installation ==
|
11 |
|
12 |
+
1. Upload the `multi-post-thumbnails` directory to the `/wp-content/plugins/` directory
|
13 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress
|
14 |
+
3. In your theme's `functions.php` register a new thumbnail for the post type you want it active for. If `post_type` is not set it defaults to `post`.
|
15 |
+
|
16 |
+
if (class_exists('MultiPostThumbnails')) {
|
17 |
+
new MultiPostThumbnails(
|
18 |
+
array(
|
19 |
+
'label' => 'Secondary Image',
|
20 |
+
'id' => 'secondary-image',
|
21 |
+
'post_type' => 'post'
|
22 |
+
)
|
23 |
+
);
|
24 |
+
}
|
25 |
+
4. Display the thumbnail in your theme. e.g. for loop templates (outside of the loop, the first argument to `MultiPostThumbnails::the_post_thumbnail()` will need to be the post type):
|
26 |
+
|
27 |
+
<?php if (class_exists('MultiPostThumbnails')) : MultiPostThumbnails::the_post_thumbnail(get_post_type(), 'secondary-image'); endif; ?>
|
28 |
+
|
29 |
+
For more, read the full documentation: http://voceconnect.github.io/multi-post-thumbnails/
|
30 |
|
31 |
== Frequently Asked Questions ==
|
32 |
|
33 |
+
See the full documentation for more: http://voceconnect.github.io/multi-post-thumbnails/
|
34 |
+
|
35 |
+
= I'm trying to upgrade to a new versions of WordPress and get an error about `MultiPostThumbnails` =
|
36 |
+
|
37 |
+
This is caused by using the example in previous readmes that didn't do a check for the `MultiPostThumbnails` class existing first. This has been corrected in the Installation section.
|
38 |
+
|
39 |
+
= How do I register the same thumbnail for multiple post types? =
|
40 |
+
|
41 |
+
You can loop through an array of the post types:
|
42 |
+
|
43 |
+
if (class_exists('MultiPostThumbnails')) {
|
44 |
+
$types = array('post', 'page', 'my_post_type');
|
45 |
+
foreach($types as $type) {
|
46 |
+
new MultiPostThumbnails(array(
|
47 |
+
'label' => 'Secondary Image',
|
48 |
+
'id' => 'secondary-image',
|
49 |
+
'post_type' => $type
|
50 |
+
)
|
51 |
+
);
|
52 |
+
}
|
53 |
+
}
|
54 |
+
|
55 |
+
= How do I use a custom thumbnail size in my theme? =
|
56 |
+
|
57 |
+
After you have registered a new post thumbnail, register a new image size for it. e.g if your post thumbnail `id` is `secondary-image` and it is for a `post`, it probably makes sense to use something like:
|
58 |
+
|
59 |
+
add_image_size('post-secondary-image-thumbnail', 250, 150);
|
60 |
+
|
61 |
+
This will register a new image size of 250x150 px. Then, when you display the thumbnail in your theme, update the call to `MultiPostThumbnails::the_post_thumbnail()` to pass in the image size:
|
62 |
+
|
63 |
+
MultiPostThumbnails::the_post_thumbnail(get_post_type(), 'secondary-image', NULL, 'post-secondary-image-thumbnail');
|
64 |
+
|
65 |
+
You can register multiple image sizes for a given thumbnail if desired.
|
66 |
+
|
67 |
+
= How can I get the thumbnail without automatically echoing it? =
|
68 |
+
|
69 |
+
Use `MultiPostThumbnails::get_the_post_thumbnail()` in place of `MultiPostThumbnails::the_post_thumbnail()`.
|
70 |
+
|
71 |
+
= How do I get just the URL of a thumbnail without the wrapping HTML? =
|
72 |
|
73 |
+
Use `MultiPostThumbnails::get_post_thumbnail_url()` passing in the following arguments:
|
74 |
|
75 |
+
* `$post_type` - the post type the thumbnail was registered for
|
76 |
+
* `$id` - the ID used to register the thumbnail (not the post ID)
|
77 |
+
* `$post_id` - optional and only needs to be passed in when outside the loop but should be passed in if available when called
|
78 |
+
|
79 |
+
For example, for a thumbnail registered with an `id` of `secondary-image` and `post_type` of `post` the following would retrieve the thumbnail URL:
|
80 |
+
|
81 |
+
MultiPostThumbnails::get_post_thumbnail_url(get_post_type(), 'secondary-image');
|
82 |
+
|
83 |
+
= When I use the sample code the thumbnail doesn't show up. What's wrong? =
|
84 |
+
|
85 |
+
* Make sure you are using the same ID you registered the thumbnail with as the second argument to `MultiPostThumbnails::the_post_thumbnail()`.
|
86 |
+
* If you are trying to get the thumbnail outside of the loop or a single template, you will need to replace `get_post_type()` with the post type you are trying to get the thumbnail for. This is common when trying to use the code in headers/footers/sidebars.
|
87 |
+
|
88 |
+
= I see the meta box in the admin when editing a post but when I click on 'Set as [label] image' in the media manager, nothing happens and I get a JavaScript console error =
|
89 |
+
|
90 |
+
If you are using a symlink to include the plugin directory in your project, the admin js file will not load and cause this. Unfortunately, the solution is to not use symlinks due to the behavior of PHP's `__FILE__`
|
91 |
+
|
92 |
+
= Is there a way to show the post meta where the thumbnail IDs are stored in the Custom Fields metabox?
|
93 |
+
|
94 |
+
Since version 1.5 these are hidden by default. To unhide them, add `add_filter('mpt_unprotect_meta', '__return_true');` to your theme's `functions.php`
|
95 |
+
|
96 |
+
= Is there a github repo? I love me some submodules! =
|
97 |
+
|
98 |
+
Yes. https://github.com/voceconnect/multi-post-thumbnails
|
99 |
+
|
100 |
+
= Pancakes or waffles? =
|
101 |
+
|
102 |
+
Pancakes.
|
103 |
|
104 |
== Screenshots ==
|
105 |
|
109 |
|
110 |
== Changelog ==
|
111 |
|
112 |
+
= 1.6 =
|
113 |
+
|
114 |
+
* Use medial modal instead of thickbox for WordPress 3.5+ (props mparolisi).
|
115 |
+
* Fix getting plugin directory name for il8n (props pixeltechnologies).
|
116 |
+
|
117 |
+
= 1.5 =
|
118 |
+
|
119 |
+
* Add a `size` parameter to `MultiPostThumbnails::get_post_thumbnail_url` to allow getting any registered size.
|
120 |
+
* Add `context` option to the args accepted when instantiating a new `MultiPostThumbnails` to specify the metabox context. Defaults to `side` (which it was previously hard coded to).
|
121 |
+
* Filter `is_protected_meta` to hide meta from the Custom Fields metabox by default (props willroy). To unhide them, add `add_filter('mpt_unprotect_meta', '__return_true');` to your theme's `functions.php`.
|
122 |
+
* il8n courtesy Horttcore
|
123 |
+
|
124 |
+
= 1.4 =
|
125 |
|
126 |
+
* Add a context parameter to the thickbox opener to narrow down the selection in the media upload tabs to the one being set/viewed (props kevinlangleyjr) which reduces clutter when many thumbnails are registered. Refactor js to use an object (props markparolisi). Hide attachment fields on 3.5 media sidebar.
|
127 |
|
128 |
= 1.3 =
|
129 |
|