Version Description
Download this release
Release Info
Developer | chrisscott |
Plugin | Multiple Post Thumbnails |
Version | 1.6.2 |
Comparing to | |
See all releases |
Code changes from version 1.6 to 1.6.2
- multi-post-thumbnails.php +9 -2
- readme.txt +11 -102
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,6 +223,13 @@ if (!class_exists('MultiPostThumbnails')) {
|
|
223 |
return $protected;
|
224 |
}
|
225 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
226 |
private function plugins_url($relative_path, $plugin_path) {
|
227 |
$template_dir = get_template_directory();
|
228 |
|
@@ -403,7 +410,7 @@ if (!class_exists('MultiPostThumbnails')) {
|
|
403 |
$content .= sprintf('<script>%s</script>', $modal_js);
|
404 |
}
|
405 |
|
406 |
-
return $content;
|
407 |
}
|
408 |
|
409 |
/**
|
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.2
|
7 |
Author: Chris Scott
|
8 |
Author URI: http://voceplatforms.com/
|
9 |
*/
|
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 |
|
410 |
$content .= sprintf('<script>%s</script>', $modal_js);
|
411 |
}
|
412 |
|
413 |
+
return apply_filters( sprintf( '%s_%s_admin_post_thumbnail_html', $this->post_type, $this->id ), $content, $post_ID, $thumbnail_id );
|
414 |
}
|
415 |
|
416 |
/**
|
readme.txt
CHANGED
@@ -2,104 +2,25 @@
|
|
2 |
Contributors: chrisscott, voceplatforms
|
3 |
Tags: thumbnails, image, featured image
|
4 |
Requires at least: 2.9.2
|
5 |
-
Tested up to:
|
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 |
-
|
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 |
-
|
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 |
-
|
74 |
|
75 |
-
|
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,21 +30,9 @@ Pancakes.
|
|
109 |
|
110 |
== Changelog ==
|
111 |
|
112 |
-
|
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 |
-
|
127 |
|
128 |
= 1.3 =
|
129 |
|
2 |
Contributors: chrisscott, voceplatforms
|
3 |
Tags: thumbnails, image, featured image
|
4 |
Requires at least: 2.9.2
|
5 |
+
Tested up to: 4.0
|
6 |
+
Stable tag: 1.6.2
|
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 |
+
Please refer to full documentation at https://github.com/voceconnect/multi-post-thumbnails/wiki
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
== Frequently Asked Questions ==
|
17 |
|
18 |
+
If you have any issues with this plugin, please log them at the Github repo for this plugin.
|
19 |
+
This is done to centralize our issues and make sure nothing goes unnoticed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
+
The URL to log an issue is https://github.com/voceconnect/multi-post-thumbnails/issues
|
22 |
|
23 |
+
See Frequently Asked Questions at https://github.com/voceconnect/multi-post-thumbnails/wiki/Frequently-Asked-Questions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
== Screenshots ==
|
26 |
|
30 |
|
31 |
== Changelog ==
|
32 |
|
33 |
+
After version 1.3, releases were tracked in github: https://github.com/voceconnect/multi-post-thumbnails/releases
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
+
Historical releases are below:
|
36 |
|
37 |
= 1.3 =
|
38 |
|