Version Description
- Added meta box positioning arguments when registering instances
- Cleaned up some CSS when Attachments instances are in the sidebar
Download this release
Release Info
Developer | jchristopher |
Plugin | Attachments |
Version | 3.3.1 |
Comparing to | |
See all releases |
Code changes from version 3.3 to 3.3.1
- README.md +10 -0
- classes/class.attachments.php +16 -2
- css/attachments.css +57 -1
- index.php +1 -1
- js/attachments.js +5 -1
- readme.txt +10 -0
README.md
CHANGED
@@ -139,6 +139,12 @@ function my_attachments( $attachments )
|
|
139 |
// all post types to utilize (string|array)
|
140 |
'post_type' => array( 'post', 'page' ),
|
141 |
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
// allowed file type(s) (array) (image|video|text|audio|application)
|
143 |
'filetype' => null, // no filetype limit
|
144 |
|
@@ -410,6 +416,10 @@ Attachments uses WordPress' built in Media library for uploads and storage.
|
|
410 |
|
411 |
<dl>
|
412 |
|
|
|
|
|
|
|
|
|
413 |
<dt>3.3</dt>
|
414 |
<dd>Added a <code>search()</code> method to allow searching for Attachments based on their attributes (e.g. attachment ID, post ID, post type, field values, etc.)</dd>
|
415 |
<dd>Improved the 'Remove' animation</dd>
|
139 |
// all post types to utilize (string|array)
|
140 |
'post_type' => array( 'post', 'page' ),
|
141 |
|
142 |
+
// meta box position (string) (normal, side or advanced)
|
143 |
+
'position' => 'normal',
|
144 |
+
|
145 |
+
// meta box priority (string) (high, default, low, core)
|
146 |
+
'priority' => 'high',
|
147 |
+
|
148 |
// allowed file type(s) (array) (image|video|text|audio|application)
|
149 |
'filetype' => null, // no filetype limit
|
150 |
|
416 |
|
417 |
<dl>
|
418 |
|
419 |
+
<dd>3.3.1</dd>
|
420 |
+
<dt>Added meta box positioning arguments when registering instances</dt>
|
421 |
+
<dt>Cleaned up some CSS when Attachments instances are in the sidebar</dt>
|
422 |
+
|
423 |
<dt>3.3</dt>
|
424 |
<dd>Added a <code>search()</code> method to allow searching for Attachments based on their attributes (e.g. attachment ID, post ID, post type, field values, etc.)</dd>
|
425 |
<dd>Improved the 'Remove' animation</dd>
|
classes/class.attachments.php
CHANGED
@@ -59,7 +59,7 @@ if ( !class_exists( 'Attachments' ) ) :
|
|
59 |
|
60 |
// establish our environment variables
|
61 |
|
62 |
-
$this->version = '3.3';
|
63 |
$this->url = ATTACHMENTS_URL;
|
64 |
$this->dir = ATTACHMENTS_DIR;
|
65 |
|
@@ -601,8 +601,10 @@ if ( !class_exists( 'Attachments' ) ) :
|
|
601 |
$instance_name = $instance;
|
602 |
$instance = (object) $this->instances[$instance];
|
603 |
$instance->name = $instance_name;
|
|
|
|
|
604 |
|
605 |
-
add_meta_box( 'attachments-' . $instance_name, __( esc_attr( $instance->label ) ), array( $this, 'meta_box_markup' ), $this->get_post_type(),
|
606 |
|
607 |
$nonce_sent = true;
|
608 |
}
|
@@ -728,6 +730,11 @@ if ( !class_exists( 'Attachments' ) ) :
|
|
728 |
// append the template
|
729 |
$element.find('.attachments-container').append(template(templateData));
|
730 |
|
|
|
|
|
|
|
|
|
|
|
731 |
// see if we need to set a default
|
732 |
// TODO: can we tie this into other field types (select, radio, checkbox)?
|
733 |
$element.find('.attachments-attachment:last .attachments-fields input, .attachments-attachment:last .attachments-fields textarea').each(function(){
|
@@ -890,6 +897,12 @@ if ( !class_exists( 'Attachments' ) ) :
|
|
890 |
// all post types to utilize (string|array)
|
891 |
'post_type' => array( 'post', 'page' ),
|
892 |
|
|
|
|
|
|
|
|
|
|
|
|
|
893 |
// maximum number of Attachments (int) (-1 is unlimited)
|
894 |
'limit' => -1,
|
895 |
|
@@ -1168,6 +1181,7 @@ if ( !class_exists( 'Attachments' ) ) :
|
|
1168 |
<div class="dimensions"><?php echo isset( $attachment->width ) ? $attachment->width : '{{ attachments.width }}' ; ?> × <?php echo isset( $attachment->height ) ? $attachment->height : '{{ attachments.height }}' ; ?></div>
|
1169 |
<?php endif; ?>
|
1170 |
<div class="delete-attachment"><a href="#"><?php _e( 'Remove', 'attachments' ); ?></a></div>
|
|
|
1171 |
</div>
|
1172 |
</div>
|
1173 |
|
59 |
|
60 |
// establish our environment variables
|
61 |
|
62 |
+
$this->version = '3.3.1';
|
63 |
$this->url = ATTACHMENTS_URL;
|
64 |
$this->dir = ATTACHMENTS_DIR;
|
65 |
|
601 |
$instance_name = $instance;
|
602 |
$instance = (object) $this->instances[$instance];
|
603 |
$instance->name = $instance_name;
|
604 |
+
$position = isset($instance->position) ? $instance->position : 'normal';
|
605 |
+
$priority = isset($instance->priority) ? $instance->priority : 'high';
|
606 |
|
607 |
+
add_meta_box( 'attachments-' . $instance_name, __( esc_attr( $instance->label ) ), array( $this, 'meta_box_markup' ), $this->get_post_type(), $position, $priority, array( 'instance' => $instance, 'setup_nonce' => !$nonce_sent ) );
|
608 |
|
609 |
$nonce_sent = true;
|
610 |
}
|
730 |
// append the template
|
731 |
$element.find('.attachments-container').append(template(templateData));
|
732 |
|
733 |
+
// if we're in a sidebar we DO want to show the fields which are normally hidden on load via CSS
|
734 |
+
if($element.parents('#side-sortables')){
|
735 |
+
$element.find('.attachments-attachment:last .attachments-fields').show();
|
736 |
+
}
|
737 |
+
|
738 |
// see if we need to set a default
|
739 |
// TODO: can we tie this into other field types (select, radio, checkbox)?
|
740 |
$element.find('.attachments-attachment:last .attachments-fields input, .attachments-attachment:last .attachments-fields textarea').each(function(){
|
897 |
// all post types to utilize (string|array)
|
898 |
'post_type' => array( 'post', 'page' ),
|
899 |
|
900 |
+
// meta box position (string) (normal, side or advanced)
|
901 |
+
'position' => 'normal',
|
902 |
+
|
903 |
+
// meta box priority (string) (high, default, low, core)
|
904 |
+
'priority' => 'high',
|
905 |
+
|
906 |
// maximum number of Attachments (int) (-1 is unlimited)
|
907 |
'limit' => -1,
|
908 |
|
1181 |
<div class="dimensions"><?php echo isset( $attachment->width ) ? $attachment->width : '{{ attachments.width }}' ; ?> × <?php echo isset( $attachment->height ) ? $attachment->height : '{{ attachments.height }}' ; ?></div>
|
1182 |
<?php endif; ?>
|
1183 |
<div class="delete-attachment"><a href="#"><?php _e( 'Remove', 'attachments' ); ?></a></div>
|
1184 |
+
<div class="attachments-attachment-fields-toggle"><a href="#"><?php _e( 'Toggle Fields', 'attachments' ); ?></a></div>
|
1185 |
</div>
|
1186 |
</div>
|
1187 |
|
css/attachments.css
CHANGED
@@ -214,4 +214,60 @@ a.attachments-invoke {
|
|
214 |
.attachments-handle img {
|
215 |
display:block;
|
216 |
cursor:pointer;
|
217 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
214 |
.attachments-handle img {
|
215 |
display:block;
|
216 |
cursor:pointer;
|
217 |
+
}
|
218 |
+
|
219 |
+
.attachments-attachment-fields-toggle {
|
220 |
+
display:none;
|
221 |
+
}
|
222 |
+
|
223 |
+
/* Side styles */
|
224 |
+
|
225 |
+
#post-body.columns-2 #side-sortables .attachments-parent-container {
|
226 |
+
padding-bottom: 41px;
|
227 |
+
}
|
228 |
+
|
229 |
+
#post-body.columns-2 #side-sortables .attachments-container {
|
230 |
+
padding-bottom: 0;
|
231 |
+
}
|
232 |
+
|
233 |
+
#post-body.columns-2 #side-sortables .attachments-attachment {
|
234 |
+
min-height: 0;
|
235 |
+
padding-bottom:15px;
|
236 |
+
}
|
237 |
+
|
238 |
+
#post-body.columns-2 #side-sortables .attachments-attachment .attachment-meta {
|
239 |
+
position: static;
|
240 |
+
margin: 15px 0 0 30px;
|
241 |
+
box-sizing: border-box;
|
242 |
+
width:88%;
|
243 |
+
}
|
244 |
+
|
245 |
+
#post-body.columns-2 #side-sortables .attachments-attachment .attachments-handle {
|
246 |
+
top:15px;
|
247 |
+
}
|
248 |
+
|
249 |
+
#post-body.columns-2 #side-sortables .attachments-attachment-fields-toggle {
|
250 |
+
display:block;
|
251 |
+
margin-top:7px;
|
252 |
+
margin-bottom:0;
|
253 |
+
}
|
254 |
+
|
255 |
+
#post-body.columns-2 #side-sortables .attachments-attachment:after:hover {
|
256 |
+
color:#d54e21;
|
257 |
+
}
|
258 |
+
|
259 |
+
#post-body.columns-2 #side-sortables .attachments-attachment .attachment-meta .attachment-details {
|
260 |
+
width:120px;
|
261 |
+
}
|
262 |
+
|
263 |
+
#post-body.columns-2 #side-sortables .attachments-attachment:last-of-type {
|
264 |
+
padding-top: 0;
|
265 |
+
padding-bottom: 15px;
|
266 |
+
margin-bottom: 0px;
|
267 |
+
}
|
268 |
+
|
269 |
+
#post-body.columns-2 #side-sortables .attachments-fields {
|
270 |
+
margin-right: 0;
|
271 |
+
margin-left: 30px;
|
272 |
+
display:none;
|
273 |
+
}
|
index.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
* Description: Attachments gives the ability to append any number of Media Library items to Pages, Posts, and Custom Post Types
|
7 |
* Author: Jonathan Christopher
|
8 |
* Author URI: http://mondaybynoon.com/
|
9 |
-
* Version: 3.3
|
10 |
* Text Domain: attachments
|
11 |
* Domain Path: /languages/
|
12 |
* License: GPLv2 or later
|
6 |
* Description: Attachments gives the ability to append any number of Media Library items to Pages, Posts, and Custom Post Types
|
7 |
* Author: Jonathan Christopher
|
8 |
* Author URI: http://mondaybynoon.com/
|
9 |
+
* Version: 3.3.1
|
10 |
* Text Domain: attachments
|
11 |
* Domain Path: /languages/
|
12 |
* License: GPLv2 or later
|
js/attachments.js
CHANGED
@@ -90,6 +90,10 @@ jQuery(document).ready(function($){
|
|
90 |
},
|
91 |
stop: function(event, ui) {
|
92 |
$(document).trigger('attachments/sortable_stop');
|
93 |
-
}
|
|
|
|
|
|
|
|
|
94 |
});
|
95 |
});
|
90 |
},
|
91 |
stop: function(event, ui) {
|
92 |
$(document).trigger('attachments/sortable_stop');
|
93 |
+
}
|
94 |
+
});
|
95 |
+
$('body').on('click','.attachments-attachment-fields-toggle > a', function(){
|
96 |
+
$(this).parents('.attachments-attachment').find('.attachments-fields').toggle();
|
97 |
+
return false;
|
98 |
});
|
99 |
});
|
readme.txt
CHANGED
@@ -107,6 +107,10 @@ Else: please reference the **Installation > Upgrade Notice** details.
|
|
107 |
|
108 |
== Changelog ==
|
109 |
|
|
|
|
|
|
|
|
|
110 |
= 3.3 =
|
111 |
* Added a `search()` method to allow searching for Attachments based on their attributes (e.g. attachment ID, post ID, post type, field values, etc.)
|
112 |
* Improved the 'Remove' animation
|
@@ -383,6 +387,12 @@ function my_attachments( $attachments )
|
|
383 |
// all post types to utilize (string|array)
|
384 |
'post_type' => array( 'post', 'page' ),
|
385 |
|
|
|
|
|
|
|
|
|
|
|
|
|
386 |
// allowed file type(s) (array) (image|video|text|audio|application)
|
387 |
'filetype' => null, // no filetype limit
|
388 |
|
107 |
|
108 |
== Changelog ==
|
109 |
|
110 |
+
= 3.3.1 =
|
111 |
+
* Added meta box positioning arguments when registering instances
|
112 |
+
* Cleaned up some CSS when Attachments instances are in the sidebar
|
113 |
+
|
114 |
= 3.3 =
|
115 |
* Added a `search()` method to allow searching for Attachments based on their attributes (e.g. attachment ID, post ID, post type, field values, etc.)
|
116 |
* Improved the 'Remove' animation
|
387 |
// all post types to utilize (string|array)
|
388 |
'post_type' => array( 'post', 'page' ),
|
389 |
|
390 |
+
// meta box position (string) (normal, side or advanced)
|
391 |
+
'position' => 'normal',
|
392 |
+
|
393 |
+
// meta box priority (string) (high, default, low, core)
|
394 |
+
'priority' => 'high',
|
395 |
+
|
396 |
// allowed file type(s) (array) (image|video|text|audio|application)
|
397 |
'filetype' => null, // no filetype limit
|
398 |
|