Version Description
- Added option to select specific theme locations to apply the responsive select menu to.
Download this release
Release Info
Developer | sevenspark |
Plugin | Responsive Select Menu |
Version | 1.2 |
Comparing to | |
See all releases |
Code changes from version 1.1 to 1.2
- readme.txt +11 -2
- responsive-select-menu.php +45 -4
- sparkoptions/SparkOptions.class.php +58 -1
- sparkoptions/sparkoptions.css +11 -1
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: sevenspark
|
|
3 |
Donate link: http://bit.ly/DonateResponsiveSelect
|
4 |
Tags: responsive, menu, select, drop down,
|
5 |
Requires at least: 3.3
|
6 |
-
Tested up to: 3.
|
7 |
Stable tag: trunk
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -12,7 +12,9 @@ The Responsive Select Menu plugin automatically turns any WordPress 3 Menu into
|
|
12 |
|
13 |
== Description ==
|
14 |
|
15 |
-
[View
|
|
|
|
|
16 |
|
17 |
One common UI paradigm for navigation menus with responsive design is to display a select box (form element)
|
18 |
for mobile devices. This plugin allows you to turn your WordPress 3 menu into a select box below a width of your choice.
|
@@ -28,6 +30,7 @@ for mobile devices. This plugin allows you to turn your WordPress 3 menu into a
|
|
28 |
|
29 |
Through the Responsive Select Menu Control Panel you can:
|
30 |
|
|
|
31 |
* Set your width breakpoint (where your menu switches from your standard menu to a select box)
|
32 |
* Configure how many levels you wish to include in the select menu. Set it to 1 to include only the top-level menu items.
|
33 |
* Choose the character used to indent your submenu items within the select box
|
@@ -64,6 +67,9 @@ in the menu.
|
|
64 |
|
65 |
== Changelog ==
|
66 |
|
|
|
|
|
|
|
67 |
= 1.1 =
|
68 |
* Fixed option closing tag order for valid HTML markup
|
69 |
|
@@ -73,6 +79,9 @@ in the menu.
|
|
73 |
|
74 |
== Upgrade Notice ==
|
75 |
|
|
|
|
|
|
|
76 |
= 1.1 =
|
77 |
* Upgrade to ensure valid markup - won't change your settings.
|
78 |
|
3 |
Donate link: http://bit.ly/DonateResponsiveSelect
|
4 |
Tags: responsive, menu, select, drop down,
|
5 |
Requires at least: 3.3
|
6 |
+
Tested up to: 3.4.2
|
7 |
Stable tag: trunk
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
|
13 |
== Description ==
|
14 |
|
15 |
+
[View Demo 1](http://wpmegamenu.com/responsive-select-menu/)
|
16 |
+
|
17 |
+
[View Demo 2 in a Responsive WordPress Theme](http://agility.sevenspark.com/responsive-select-menu)
|
18 |
|
19 |
One common UI paradigm for navigation menus with responsive design is to display a select box (form element)
|
20 |
for mobile devices. This plugin allows you to turn your WordPress 3 menu into a select box below a width of your choice.
|
30 |
|
31 |
Through the Responsive Select Menu Control Panel you can:
|
32 |
|
33 |
+
* New in 1.2 - select which theme locations to apply the menu to
|
34 |
* Set your width breakpoint (where your menu switches from your standard menu to a select box)
|
35 |
* Configure how many levels you wish to include in the select menu. Set it to 1 to include only the top-level menu items.
|
36 |
* Choose the character used to indent your submenu items within the select box
|
67 |
|
68 |
== Changelog ==
|
69 |
|
70 |
+
= 1.2 =
|
71 |
+
* Added option to select specific theme locations to apply the responsive select menu to.
|
72 |
+
|
73 |
= 1.1 =
|
74 |
* Fixed option closing tag order for valid HTML markup
|
75 |
|
79 |
|
80 |
== Upgrade Notice ==
|
81 |
|
82 |
+
= 1.2 =
|
83 |
+
* Allows you to apply the menu selectively to registered theme locations.
|
84 |
+
|
85 |
= 1.1 =
|
86 |
* Upgrade to ensure valid markup - won't change your settings.
|
87 |
|
responsive-select-menu.php
CHANGED
@@ -4,13 +4,13 @@
|
|
4 |
Plugin Name: Responsive Select Menu
|
5 |
Plugin URI: http://wpmegamenu.com/responsive-select-menu
|
6 |
Description: Turn your menu into a select box at small viewport sizes
|
7 |
-
Version: 1.
|
8 |
Author: Chris Mavricos, SevenSpark
|
9 |
Author URI: http://sevenspark.com
|
10 |
Copyright 2011-2012 Chris Mavricos, SevenSpark http://sevenspark.com (email : chris@sevenspark.com)
|
11 |
*/
|
12 |
|
13 |
-
define( 'RESPONSIVE_SELECT_MENU_VERSION', '1.
|
14 |
define( 'RESPONSIVE_SELECT_MENU_SETTINGS', 'responsive-select-menu' );
|
15 |
|
16 |
require_once( 'sparkoptions/SparkOptions.class.php' ); //SevenSpark Options Panel
|
@@ -40,7 +40,7 @@ class ResponsiveMenuSelect{
|
|
40 |
//Filters
|
41 |
add_filter( 'wp_nav_menu_args' , array( $this , 'responsiveSelectAddFilter' ), 2100 ); //filters arguments passed to wp_nav_menu
|
42 |
|
43 |
-
add_filter( 'wp_nav_menu_args' , array( $this , 'responsiveSelectFilter' ), 2200 );
|
44 |
|
45 |
}
|
46 |
|
@@ -70,6 +70,28 @@ class ResponsiveMenuSelect{
|
|
70 |
return $this->enabled;
|
71 |
}
|
72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
|
74 |
function loadAssets(){
|
75 |
|
@@ -126,10 +148,11 @@ jQuery(document).ready( function($){
|
|
126 |
<?php
|
127 |
}
|
128 |
}
|
|
|
129 |
|
130 |
function responsiveSelectAddFilter( $args ){
|
131 |
|
132 |
-
if( $this->isEnabled() ){
|
133 |
|
134 |
//Don't add it twice (when it gets called again by selectNavMenu() )
|
135 |
if( isset( $args['responsiveMenuSelect'] ) && $args['responsiveMenuSelect'] == true ) {
|
@@ -264,6 +287,24 @@ jQuery(document).ready( function($){
|
|
264 |
'off'
|
265 |
);
|
266 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
267 |
|
268 |
|
269 |
|
4 |
Plugin Name: Responsive Select Menu
|
5 |
Plugin URI: http://wpmegamenu.com/responsive-select-menu
|
6 |
Description: Turn your menu into a select box at small viewport sizes
|
7 |
+
Version: 1.2
|
8 |
Author: Chris Mavricos, SevenSpark
|
9 |
Author URI: http://sevenspark.com
|
10 |
Copyright 2011-2012 Chris Mavricos, SevenSpark http://sevenspark.com (email : chris@sevenspark.com)
|
11 |
*/
|
12 |
|
13 |
+
define( 'RESPONSIVE_SELECT_MENU_VERSION', '1.2' );
|
14 |
define( 'RESPONSIVE_SELECT_MENU_SETTINGS', 'responsive-select-menu' );
|
15 |
|
16 |
require_once( 'sparkoptions/SparkOptions.class.php' ); //SevenSpark Options Panel
|
40 |
//Filters
|
41 |
add_filter( 'wp_nav_menu_args' , array( $this , 'responsiveSelectAddFilter' ), 2100 ); //filters arguments passed to wp_nav_menu
|
42 |
|
43 |
+
add_filter( 'wp_nav_menu_args' , array( $this , 'responsiveSelectFilter' ), 2200 ); //second call, to print select menu
|
44 |
|
45 |
}
|
46 |
|
70 |
return $this->enabled;
|
71 |
}
|
72 |
|
73 |
+
/**
|
74 |
+
* Determine whether this particular menu location should be activated
|
75 |
+
*/
|
76 |
+
function isActivated( $args ){
|
77 |
+
|
78 |
+
//Activate All?
|
79 |
+
if( $this->settings->op( 'activate_theme_locations_all' ) ){
|
80 |
+
return true;
|
81 |
+
}
|
82 |
+
|
83 |
+
//Activate this theme_location specifically?
|
84 |
+
if( isset( $args['theme_location'] ) ){
|
85 |
+
$location = $args['theme_location'];
|
86 |
+
$active_theme_locations = $this->settings->op( 'active_theme_locations' );
|
87 |
+
|
88 |
+
if( is_array( $active_theme_locations ) && in_array( $location, $active_theme_locations ) ){
|
89 |
+
return true;
|
90 |
+
}
|
91 |
+
}
|
92 |
+
return false;
|
93 |
+
}
|
94 |
+
|
95 |
|
96 |
function loadAssets(){
|
97 |
|
148 |
<?php
|
149 |
}
|
150 |
}
|
151 |
+
|
152 |
|
153 |
function responsiveSelectAddFilter( $args ){
|
154 |
|
155 |
+
if( $this->isEnabled() && $this->isActivated( $args ) ){
|
156 |
|
157 |
//Don't add it twice (when it gets called again by selectNavMenu() )
|
158 |
if( isset( $args['responsiveMenuSelect'] ) && $args['responsiveMenuSelect'] == true ) {
|
287 |
'off'
|
288 |
);
|
289 |
|
290 |
+
$sparkOps->addSubHeader( $basic,
|
291 |
+
'activate_theme_locations_header',
|
292 |
+
'Activate Theme Locations'
|
293 |
+
);
|
294 |
+
|
295 |
+
$sparkOps->addCheckbox( $basic,
|
296 |
+
'activate_theme_locations_all',
|
297 |
+
'Activate All Theme Locations',
|
298 |
+
'Apply the responsive select menu to all menus',
|
299 |
+
'on'
|
300 |
+
);
|
301 |
+
|
302 |
+
$sparkOps->addChecklist( $basic,
|
303 |
+
'active_theme_locations',
|
304 |
+
'Selectively Activate Theme Locations',
|
305 |
+
'Disable the above and activate only the theme locations you want. These theme locations correspond to the Theme Locations Meta Box in Appearance > Menus',
|
306 |
+
'get_registered_nav_menus'
|
307 |
+
);
|
308 |
|
309 |
|
310 |
|
sparkoptions/SparkOptions.class.php
CHANGED
@@ -246,6 +246,7 @@ class ResponsiveMenuSelectOptions{
|
|
246 |
'default'=> '',
|
247 |
'special_class' => '',
|
248 |
'gradient' => false,
|
|
|
249 |
)));
|
250 |
|
251 |
$settings = $this->getSettings();
|
@@ -291,10 +292,51 @@ class ResponsiveMenuSelectOptions{
|
|
291 |
$html.= '<div class="clear"></div>';
|
292 |
|
293 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
294 |
|
295 |
case 'select':
|
296 |
|
297 |
-
$html.= '<label class="spark-admin-op-title">'.$title.'</label>'; //$title;
|
|
|
298 |
$html.= '<select id="'.$id.'" name="'.$id.'" >';
|
299 |
|
300 |
if(!is_array($ops)) $ops = $ops(); //if it's not an array it's a function that produces an array
|
@@ -448,6 +490,21 @@ class ResponsiveMenuSelectOptions{
|
|
448 |
$this->addToPanel( $panel_id , $id );
|
449 |
|
450 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
451 |
|
452 |
function addRadio( $panel_id , $id , $title , $desc = '' , $ops = array() , $default = '' , $special_class = '' ){
|
453 |
|
246 |
'default'=> '',
|
247 |
'special_class' => '',
|
248 |
'gradient' => false,
|
249 |
+
'default_all' => 'off',
|
250 |
)));
|
251 |
|
252 |
$settings = $this->getSettings();
|
292 |
$html.= '<div class="clear"></div>';
|
293 |
|
294 |
break;
|
295 |
+
|
296 |
+
case 'checklist':
|
297 |
+
|
298 |
+
$html.= '<label class="spark-admin-op-title">'.$config['title'].'</label>'; //$title;
|
299 |
+
$html.= $desc;
|
300 |
+
$html.= '<div class="spark-admin-checklist">';
|
301 |
+
|
302 |
+
if(!is_array($ops)) $ops = $ops(); //if it's not an array it's a function that produces an array
|
303 |
+
|
304 |
+
if(is_array($ops)){
|
305 |
+
|
306 |
+
$val = '';
|
307 |
+
$multi = false;
|
308 |
+
|
309 |
+
if( isset( $settings[$id] ) ){
|
310 |
+
$val = $settings[$id];
|
311 |
+
if( is_array( $val ) ){
|
312 |
+
$multi = true;
|
313 |
+
}
|
314 |
+
}
|
315 |
+
//print_r( $val );
|
316 |
+
|
317 |
+
$k = 0;
|
318 |
+
foreach($ops as $opVal => $op){
|
319 |
+
//echo "val = $val";
|
320 |
+
$checked = '';
|
321 |
+
if( $multi ){
|
322 |
+
$checked = in_array( $opVal, $val ) ? 'checked="checked"' : '';
|
323 |
+
}
|
324 |
+
else $checked = $opVal == $val ? 'checked="checked"' : '';
|
325 |
+
$input_id = $id.'-'.$k;
|
326 |
+
$html.= '<label class="spark-admin-op-title" for="'.$input_id.'">'.$op.'</label> <input type="checkbox" value="'.$opVal.'" '.$checked.' name="'.$id.'[]" id="'.$input_id.'" />';
|
327 |
+
$k++;
|
328 |
+
}
|
329 |
+
}
|
330 |
+
|
331 |
+
$html.= '</div>';
|
332 |
+
|
333 |
+
break;
|
334 |
+
|
335 |
|
336 |
case 'select':
|
337 |
|
338 |
+
$html.= '<label class="spark-admin-op-title">'.$config['title'].'</label>'; //$title;
|
339 |
+
|
340 |
$html.= '<select id="'.$id.'" name="'.$id.'" >';
|
341 |
|
342 |
if(!is_array($ops)) $ops = $ops(); //if it's not an array it's a function that produces an array
|
490 |
$this->addToPanel( $panel_id , $id );
|
491 |
|
492 |
}
|
493 |
+
|
494 |
+
function addChecklist( $panel_id , $id , $title , $desc = '' , $ops = array(), $default = '' , $default_all='off', $special_class = '' ){
|
495 |
+
$this->ops[$id] = array(
|
496 |
+
'title' => $title,
|
497 |
+
'desc' => $desc,
|
498 |
+
'ops' => $ops,
|
499 |
+
'default' => $default,
|
500 |
+
'default_all' => $default_all,
|
501 |
+
'special_class' => $special_class,
|
502 |
+
|
503 |
+
'type' => 'checklist',
|
504 |
+
);
|
505 |
+
|
506 |
+
$this->addToPanel( $panel_id , $id );
|
507 |
+
}
|
508 |
|
509 |
function addRadio( $panel_id , $id , $title , $desc = '' , $ops = array() , $default = '' , $special_class = '' ){
|
510 |
|
sparkoptions/sparkoptions.css
CHANGED
@@ -326,9 +326,19 @@ label.spark-admin-op-title{
|
|
326 |
}
|
327 |
|
328 |
/* Checkbox */
|
329 |
-
.spark-admin-op.container-type-checkbox label.spark-admin-op-title
|
|
|
330 |
float:left;
|
331 |
width:200px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
332 |
}
|
333 |
|
334 |
/* Select */
|
326 |
}
|
327 |
|
328 |
/* Checkbox */
|
329 |
+
.spark-admin-op.container-type-checkbox label.spark-admin-op-title,
|
330 |
+
.spark-admin-op.container-type-checklist .spark-admin-checklist label.spark-admin-op-title{
|
331 |
float:left;
|
332 |
width:200px;
|
333 |
+
clear:both;
|
334 |
+
}
|
335 |
+
.spark-admin-op.container-type-checklist .spark-admin-checklist{
|
336 |
+
margin-top:10px;
|
337 |
+
}
|
338 |
+
.spark-admin-op.container-type-checklist .spark-admin-checklist label{
|
339 |
+
margin-bottom:10px;
|
340 |
+
font-weight:normal;
|
341 |
+
font-style:italic;
|
342 |
}
|
343 |
|
344 |
/* Select */
|