Version Description
- Released on 12th August 2013
- Don't cache media frame and instead load new each time
- Don't overwrite
wp.media.view.settings
but extend it, and only with post data - Force listing of images uploading only to current post
Download this release
Release Info
Developer | dimadin |
Plugin | Nav Menu Images |
Version | 3.1 |
Comparing to | |
See all releases |
Code changes from version 3.0 to 3.1
- inc/admin.php +1 -1
- inc/media-view.js +9 -3
- inc/walker.php +1 -13
- nav-menu-images.php +1 -1
- readme.txt +9 -3
inc/admin.php
CHANGED
@@ -88,7 +88,7 @@ class Nav_Menu_Images_Admin extends Nav_Menu_Images {
|
|
88 |
// For WP 3.5+, enqueue new script & dependicies
|
89 |
if ( version_compare( $wp_version, '3.5', '>=' ) ) {
|
90 |
wp_enqueue_media();
|
91 |
-
wp_enqueue_script( 'nmi-media-view', plugins_url( 'media-view.js', __FILE__ ), array( 'jquery', 'media-editor', 'media-views', 'post' ), '1.
|
92 |
}
|
93 |
|
94 |
do_action( 'nmi_enqueue_scripts' );
|
88 |
// For WP 3.5+, enqueue new script & dependicies
|
89 |
if ( version_compare( $wp_version, '3.5', '>=' ) ) {
|
90 |
wp_enqueue_media();
|
91 |
+
wp_enqueue_script( 'nmi-media-view', plugins_url( 'media-view.js', __FILE__ ), array( 'jquery', 'media-editor', 'media-views', 'post' ), '1.1', true );
|
92 |
}
|
93 |
|
94 |
do_action( 'nmi_enqueue_scripts' );
|
inc/media-view.js
CHANGED
@@ -7,6 +7,12 @@
|
|
7 |
* @subpackage Media View
|
8 |
*/
|
9 |
jQuery(document).ready(function($){
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
// Prepare the variable that holds our custom media manager.
|
11 |
// Based on wp.media.featuredImage
|
12 |
wp.media.nmi = {
|
@@ -36,8 +42,8 @@ jQuery(document).ready(function($){
|
|
36 |
},
|
37 |
|
38 |
frame: function() {
|
39 |
-
if ( this._frame )
|
40 |
-
return this._frame
|
41 |
|
42 |
this._frame = wp.media({
|
43 |
state: 'featured-image',
|
@@ -73,7 +79,7 @@ jQuery(document).ready(function($){
|
|
73 |
event.stopPropagation();
|
74 |
|
75 |
var nmi_clicked_item_id = $(this).data('id');
|
76 |
-
wp.media.view.settings = nmi_settings[nmi_clicked_item_id];
|
77 |
|
78 |
wp.media.nmi.frame().open();
|
79 |
// Update the featured image id when the 'remove' link is clicked.
|
7 |
* @subpackage Media View
|
8 |
*/
|
9 |
jQuery(document).ready(function($){
|
10 |
+
// Workaround to make "Uploaded to this post" default
|
11 |
+
// Based on http://wordpress.stackexchange.com/a/76213
|
12 |
+
$(document).ajaxStop(function() {
|
13 |
+
$('.media-toolbar select.attachment-filters option[value="uploaded"]').attr( 'selected', true ).parent().trigger('change');
|
14 |
+
});
|
15 |
+
|
16 |
// Prepare the variable that holds our custom media manager.
|
17 |
// Based on wp.media.featuredImage
|
18 |
wp.media.nmi = {
|
42 |
},
|
43 |
|
44 |
frame: function() {
|
45 |
+
/*if ( this._frame )
|
46 |
+
return this._frame;*/
|
47 |
|
48 |
this._frame = wp.media({
|
49 |
state: 'featured-image',
|
79 |
event.stopPropagation();
|
80 |
|
81 |
var nmi_clicked_item_id = $(this).data('id');
|
82 |
+
wp.media.view.settings = $.extend({}, wp.media.view.settings, nmi_settings[nmi_clicked_item_id]);
|
83 |
|
84 |
wp.media.nmi.frame().open();
|
85 |
// Update the featured image id when the 'remove' link is clicked.
|
inc/walker.php
CHANGED
@@ -135,19 +135,7 @@ class NMI_Walker_Nav_Menu_Edit extends Walker_Nav_Menu_Edit {
|
|
135 |
return;
|
136 |
|
137 |
// Prepare general settings
|
138 |
-
$settings = array(
|
139 |
-
'nonce' => array(
|
140 |
-
'sendToEditor' => wp_create_nonce( 'media-send-to-editor' ),
|
141 |
-
),
|
142 |
-
'post' => array(
|
143 |
-
'id' => 0,
|
144 |
-
),
|
145 |
-
'defaultProps' => array(
|
146 |
-
'link' => get_option( 'image_default_link_type' ), // db default is 'file'
|
147 |
-
'align' => get_option( 'image_default_align' ), // empty default
|
148 |
-
'size' => get_option( 'image_default_size' ), // empty default
|
149 |
-
)
|
150 |
-
);
|
151 |
|
152 |
// Prepare post specific settings
|
153 |
$post = null;
|
135 |
return;
|
136 |
|
137 |
// Prepare general settings
|
138 |
+
$settings = array();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
|
140 |
// Prepare post specific settings
|
141 |
$post = null;
|
nav-menu-images.php
CHANGED
@@ -15,7 +15,7 @@
|
|
15 |
* Description: Display image as a menu content.
|
16 |
* Author: Milan Dinić
|
17 |
* Author URI: http://blog.milandinic.com/
|
18 |
-
* Version: 3.
|
19 |
* Text Domain: nmi
|
20 |
* Domain Path: /languages/
|
21 |
* License: GPL
|
15 |
* Description: Display image as a menu content.
|
16 |
* Author: Milan Dinić
|
17 |
* Author URI: http://blog.milandinic.com/
|
18 |
+
* Version: 3.1
|
19 |
* Text Domain: nmi
|
20 |
* Domain Path: /languages/
|
21 |
* License: GPL
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: dimadin
|
|
3 |
Donate link: http://blog.milandinic.com/donate/
|
4 |
Tags: nav menu, menu, media, image
|
5 |
Requires at least: 3.1
|
6 |
-
Tested up to: 3.
|
7 |
-
Stable tag: 3.
|
8 |
|
9 |
Display image as a menu item content.
|
10 |
|
@@ -14,7 +14,7 @@ Display image as a menu item content.
|
|
14 |
|
15 |
This plugin enables you to upload images for nav menu items on a menu edit screen. By default, those images will be displayed instead of text for respective menu items. Note that after upload, you should set an image as 'featured' to be able to display it.
|
16 |
|
17 |
-
You can also set images that will be displayed only when you hover menu item, or when menu item is of currently displayed page.
|
18 |
|
19 |
Developers can use many available filters to make their own way of displaying images, or even create a child class on top of base one. See source code for more ideas.
|
20 |
|
@@ -41,6 +41,12 @@ There are no configuration options in this plugin.
|
|
41 |
|
42 |
== Changelog ==
|
43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
= 3.0 =
|
45 |
* Released on 26th March 2013
|
46 |
* Add support for active and hover menu item images
|
3 |
Donate link: http://blog.milandinic.com/donate/
|
4 |
Tags: nav menu, menu, media, image
|
5 |
Requires at least: 3.1
|
6 |
+
Tested up to: 3.6
|
7 |
+
Stable tag: 3.1
|
8 |
|
9 |
Display image as a menu item content.
|
10 |
|
14 |
|
15 |
This plugin enables you to upload images for nav menu items on a menu edit screen. By default, those images will be displayed instead of text for respective menu items. Note that after upload, you should set an image as 'featured' to be able to display it.
|
16 |
|
17 |
+
You can also set images that will be displayed only when you hover menu item, or when menu item is of currently displayed page. [Read detailed instructions about using plugin](http://blog.milandinic.com/wordpress/plugins/nav-menu-images/#how-to-use).
|
18 |
|
19 |
Developers can use many available filters to make their own way of displaying images, or even create a child class on top of base one. See source code for more ideas.
|
20 |
|
41 |
|
42 |
== Changelog ==
|
43 |
|
44 |
+
= 3.1 =
|
45 |
+
* Released on 12th August 2013
|
46 |
+
* Don't cache media frame and instead load new each time
|
47 |
+
* Don't overwrite `wp.media.view.settings` but extend it, and only with post data
|
48 |
+
* Force listing of images uploading only to current post
|
49 |
+
|
50 |
= 3.0 =
|
51 |
* Released on 26th March 2013
|
52 |
* Add support for active and hover menu item images
|