Version Description
Download this release
Release Info
Developer | damiroquai |
Plugin | myStickymenu |
Version | 1.3 |
Comparing to | |
See all releases |
Code changes from version 1.2 to 1.3
- mystickymenu.css +1 -38
- mystickymenu.php +84 -31
- readme.txt +4 -5
- screenshot-1.png +0 -0
mystickymenu.css
CHANGED
@@ -1,38 +1 @@
|
|
1 |
-
|
2 |
-
z-index: 100000;
|
3 |
-
/*add this line if you use 100% menu width, usually not needed*/
|
4 |
-
/*max-width: 100% !important;*/
|
5 |
-
text-transform:uppercase;
|
6 |
-
font-weight:bold;
|
7 |
-
-webkit-transition: 0.2s;
|
8 |
-
-moz-transition: 0.2s;
|
9 |
-
-o-transition: 0.2s;
|
10 |
-
transition: 0.2s;
|
11 |
-
}
|
12 |
-
.myfixed {
|
13 |
-
position: fixed;
|
14 |
-
top: 0;
|
15 |
-
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=95)";
|
16 |
-
filter: alpha(opacity=95);
|
17 |
-
opacity:.95;
|
18 |
-
background-color: #C94812 !important;
|
19 |
-
}
|
20 |
-
.nav-menu li a:hover {
|
21 |
-
background-color: #111 !important;
|
22 |
-
-webkit-transition: 0.6s;
|
23 |
-
-moz-transition: 0.6s;
|
24 |
-
-o-transition: 0.6s;
|
25 |
-
transition: 0.6s;
|
26 |
-
}
|
27 |
-
.nav-menu .current_page_item > a,
|
28 |
-
.nav-menu .current_page_ancestor > a,
|
29 |
-
.nav-menu .current-menu-item > a,
|
30 |
-
.nav-menu .current-menu-ancestor > a {
|
31 |
-
color: #fff !important;
|
32 |
-
font-style: normal !important;
|
33 |
-
background-color:#111 !important;
|
34 |
-
}
|
35 |
-
#wpadminbar {
|
36 |
-
position: absolute !important;
|
37 |
-
top: 0px !important;
|
38 |
-
}
|
1 |
+
/*Depracated*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mystickymenu.php
CHANGED
@@ -3,12 +3,14 @@
|
|
3 |
Plugin Name: myStickymenu
|
4 |
Plugin URI: http://wordpress.transformnews.com/plugins/mystickymenu-simple-sticky-fixed-on-top-menu-implementation-for-twentythirteen-menu-269
|
5 |
Description: Simple sticky (fixed on top) menu implementation for default Twentythirteen navigation menu. For other themes, after install go to Settings / myStickymenu and change navigation class to .your_navbar_class or #your_navbar_id.
|
6 |
-
Version: 1.
|
7 |
Author: m.r.d.a
|
8 |
License: GPLv2 or later
|
9 |
*/
|
|
|
|
|
10 |
|
11 |
-
//
|
12 |
class MyStickyMenuPage
|
13 |
{
|
14 |
/**
|
@@ -82,6 +84,8 @@ class MyStickyMenuPage
|
|
82 |
'myfixed_bgcolor' => '#F39A30',
|
83 |
'myfixed_opacity' => '95',
|
84 |
'myfixed_transition_time' => '0.3',
|
|
|
|
|
85 |
|
86 |
);
|
87 |
|
@@ -111,7 +115,7 @@ class MyStickyMenuPage
|
|
111 |
|
112 |
add_settings_field(
|
113 |
'mysticky_class_selector', // ID
|
114 |
-
'
|
115 |
array( $this, 'mysticky_class_selector_callback' ), // Callback
|
116 |
'my-stickymenu-settings', // Page
|
117 |
'setting_section_id' // Section
|
@@ -119,7 +123,7 @@ class MyStickyMenuPage
|
|
119 |
|
120 |
add_settings_field(
|
121 |
'myfixed_zindex',
|
122 |
-
'
|
123 |
array( $this, 'myfixed_zindex_callback' ),
|
124 |
'my-stickymenu-settings',
|
125 |
'setting_section_id'
|
@@ -127,7 +131,7 @@ class MyStickyMenuPage
|
|
127 |
|
128 |
add_settings_field(
|
129 |
'myfixed_width',
|
130 |
-
'
|
131 |
array( $this, 'myfixed_width_callback' ),
|
132 |
'my-stickymenu-settings',
|
133 |
'setting_section_id'
|
@@ -135,7 +139,7 @@ class MyStickyMenuPage
|
|
135 |
|
136 |
add_settings_field(
|
137 |
'myfixed_bgcolor',
|
138 |
-
'
|
139 |
array( $this, 'myfixed_bgcolor_callback' ),
|
140 |
'my-stickymenu-settings',
|
141 |
'setting_section_id'
|
@@ -151,14 +155,27 @@ class MyStickyMenuPage
|
|
151 |
|
152 |
add_settings_field(
|
153 |
'myfixed_transition_time',
|
154 |
-
'
|
155 |
array( $this, 'myfixed_transition_time_callback' ),
|
156 |
'my-stickymenu-settings',
|
157 |
'setting_section_id'
|
158 |
);
|
159 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
}
|
161 |
-
|
162 |
/**
|
163 |
* Sanitize each setting field as needed
|
164 |
*
|
@@ -183,7 +200,13 @@ class MyStickyMenuPage
|
|
183 |
$new_input['myfixed_opacity'] = sanitize_text_field( $input['myfixed_opacity'] );
|
184 |
|
185 |
if( isset( $input['myfixed_transition_time'] ) )
|
186 |
-
$new_input['myfixed_transition_time'] = sanitize_text_field( $input['myfixed_transition_time'] );
|
|
|
|
|
|
|
|
|
|
|
|
|
187 |
|
188 |
return $new_input;
|
189 |
}
|
@@ -193,7 +216,7 @@ class MyStickyMenuPage
|
|
193 |
*/
|
194 |
public function print_section_info()
|
195 |
{
|
196 |
-
print 'Change
|
197 |
}
|
198 |
|
199 |
/**
|
@@ -206,9 +229,6 @@ class MyStickyMenuPage
|
|
206 |
isset( $this->options['mysticky_class_selector'] ) ? esc_attr( $this->options['mysticky_class_selector']) : ''
|
207 |
);
|
208 |
}
|
209 |
-
|
210 |
-
/**
|
211 |
-
* Get the settings option array and print one of its values*/
|
212 |
|
213 |
public function myfixed_zindex_callback()
|
214 |
{
|
@@ -248,8 +268,24 @@ class MyStickyMenuPage
|
|
248 |
'<input type="text" id="myfixed_transition_time" name="mysticky_option_name[myfixed_transition_time]" value="%s" /> in seconds, default 0.3',
|
249 |
isset( $this->options['myfixed_transition_time'] ) ? esc_attr( $this->options['myfixed_transition_time']) : ''
|
250 |
);
|
251 |
-
}
|
252 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
253 |
}
|
254 |
|
255 |
if( is_admin() )
|
@@ -258,7 +294,7 @@ if( is_admin() )
|
|
258 |
// end plugin admin settings
|
259 |
|
260 |
|
261 |
-
//
|
262 |
|
263 |
function mysticky_remove_more_jump_link($link) {
|
264 |
$offset = strpos($link, '#more-');
|
@@ -272,43 +308,60 @@ function mysticky_remove_more_jump_link($link) {
|
|
272 |
}
|
273 |
add_filter('the_content_more_link', 'mysticky_remove_more_jump_link');
|
274 |
|
275 |
-
//
|
276 |
|
277 |
function mysticky_build_stylesheet_content() {
|
278 |
$mysticky_options = get_option( 'mysticky_option_name' );
|
279 |
-
echo
|
280 |
-
|
281 |
-
|
|
|
|
|
|
|
282 |
position: absolute !important;
|
283 |
top: 0px !important;
|
284 |
}
|
285 |
-
|
286 |
-
|
287 |
-
|
|
|
|
|
|
|
|
|
288 |
z-index: '. $mysticky_options ['myfixed_zindex'] .';
|
289 |
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=' . $mysticky_options ['myfixed_opacity'] . ')";
|
290 |
filter: alpha(opacity=' . $mysticky_options ['myfixed_opacity'] . ');
|
291 |
opacity:.' . $mysticky_options ['myfixed_opacity'] . ';
|
292 |
-
|
293 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
294 |
-webkit-transition: ' . $mysticky_options ['myfixed_transition_time'] . 's;
|
295 |
-moz-transition: ' . $mysticky_options ['myfixed_transition_time'] . 's;
|
296 |
-o-transition: ' . $mysticky_options ['myfixed_transition_time'] . 's;
|
297 |
transition: ' . $mysticky_options ['myfixed_transition_time'] . 's;
|
298 |
}
|
299 |
-
|
300 |
-
'
|
301 |
-
|
|
|
|
|
|
|
|
|
|
|
302 |
}
|
303 |
add_action('wp_head', 'mysticky_build_stylesheet_content');
|
304 |
|
305 |
|
306 |
function mystickymenu_script() {
|
307 |
|
308 |
-
// options on frontpage
|
309 |
$mysticky_options = get_option( 'mysticky_option_name' );
|
310 |
|
311 |
-
//
|
312 |
wp_register_script('mystickymenu', WP_PLUGIN_URL. '/mystickymenu/mystickymenu.js', false,'1.0.0', true);
|
313 |
wp_enqueue_script( 'mystickymenu' );
|
314 |
|
3 |
Plugin Name: myStickymenu
|
4 |
Plugin URI: http://wordpress.transformnews.com/plugins/mystickymenu-simple-sticky-fixed-on-top-menu-implementation-for-twentythirteen-menu-269
|
5 |
Description: Simple sticky (fixed on top) menu implementation for default Twentythirteen navigation menu. For other themes, after install go to Settings / myStickymenu and change navigation class to .your_navbar_class or #your_navbar_id.
|
6 |
+
Version: 1.3
|
7 |
Author: m.r.d.a
|
8 |
License: GPLv2 or later
|
9 |
*/
|
10 |
+
// Block direct acess to the file
|
11 |
+
defined('ABSPATH') or die("Cannot access pages directly.");
|
12 |
|
13 |
+
// Add plugin admin settings by Otto
|
14 |
class MyStickyMenuPage
|
15 |
{
|
16 |
/**
|
84 |
'myfixed_bgcolor' => '#F39A30',
|
85 |
'myfixed_opacity' => '95',
|
86 |
'myfixed_transition_time' => '0.3',
|
87 |
+
'myfixed_disable_small_screen' => false,
|
88 |
+
'myfixed_disable_admin_bar' => false
|
89 |
|
90 |
);
|
91 |
|
115 |
|
116 |
add_settings_field(
|
117 |
'mysticky_class_selector', // ID
|
118 |
+
'Sticky Class', // Title
|
119 |
array( $this, 'mysticky_class_selector_callback' ), // Callback
|
120 |
'my-stickymenu-settings', // Page
|
121 |
'setting_section_id' // Section
|
123 |
|
124 |
add_settings_field(
|
125 |
'myfixed_zindex',
|
126 |
+
'Sticky z-index',
|
127 |
array( $this, 'myfixed_zindex_callback' ),
|
128 |
'my-stickymenu-settings',
|
129 |
'setting_section_id'
|
131 |
|
132 |
add_settings_field(
|
133 |
'myfixed_width',
|
134 |
+
'Sticky Width',
|
135 |
array( $this, 'myfixed_width_callback' ),
|
136 |
'my-stickymenu-settings',
|
137 |
'setting_section_id'
|
139 |
|
140 |
add_settings_field(
|
141 |
'myfixed_bgcolor',
|
142 |
+
'Sticky Background Color',
|
143 |
array( $this, 'myfixed_bgcolor_callback' ),
|
144 |
'my-stickymenu-settings',
|
145 |
'setting_section_id'
|
155 |
|
156 |
add_settings_field(
|
157 |
'myfixed_transition_time',
|
158 |
+
'Sticky Transition Time',
|
159 |
array( $this, 'myfixed_transition_time_callback' ),
|
160 |
'my-stickymenu-settings',
|
161 |
'setting_section_id'
|
162 |
);
|
163 |
+
add_settings_field(
|
164 |
+
'myfixed_disable_small_screen',
|
165 |
+
'Enable at Small Screen Sizes',
|
166 |
+
array( $this, 'myfixed_disable_small_screen_callback' ),
|
167 |
+
'my-stickymenu-settings',
|
168 |
+
'setting_section_id'
|
169 |
+
);
|
170 |
+
add_settings_field(
|
171 |
+
'myfixed_disable_admin_bar',
|
172 |
+
'Remove CSS Rules for Static Admin Bar while Sticky',
|
173 |
+
array( $this, 'myfixed_disable_admin_bar_callback' ),
|
174 |
+
'my-stickymenu-settings',
|
175 |
+
'setting_section_id'
|
176 |
+
);
|
177 |
}
|
178 |
+
|
179 |
/**
|
180 |
* Sanitize each setting field as needed
|
181 |
*
|
200 |
$new_input['myfixed_opacity'] = sanitize_text_field( $input['myfixed_opacity'] );
|
201 |
|
202 |
if( isset( $input['myfixed_transition_time'] ) )
|
203 |
+
$new_input['myfixed_transition_time'] = sanitize_text_field( $input['myfixed_transition_time'] );
|
204 |
+
|
205 |
+
if( isset( $input['myfixed_disable_small_screen'] ) )
|
206 |
+
$new_input['myfixed_disable_small_screen'] = sanitize_text_field( $input['myfixed_disable_small_screen'] );
|
207 |
+
|
208 |
+
if( isset( $input['myfixed_disable_admin_bar'] ) )
|
209 |
+
$new_input['myfixed_disable_admin_bar'] = sanitize_text_field( $input['myfixed_disable_admin_bar'] );
|
210 |
|
211 |
return $new_input;
|
212 |
}
|
216 |
*/
|
217 |
public function print_section_info()
|
218 |
{
|
219 |
+
print 'Change myStickymenu options to suite your needs. Default plugin settings work for Twenty Thirteen theme. For other themes you will probably need to change sticky class, please note that some options may be overriden by your theme css. Use .myfixed class in theme or theme child stylesheet for sticky menu if you need extra css settings.';
|
220 |
}
|
221 |
|
222 |
/**
|
229 |
isset( $this->options['mysticky_class_selector'] ) ? esc_attr( $this->options['mysticky_class_selector']) : ''
|
230 |
);
|
231 |
}
|
|
|
|
|
|
|
232 |
|
233 |
public function myfixed_zindex_callback()
|
234 |
{
|
268 |
'<input type="text" id="myfixed_transition_time" name="mysticky_option_name[myfixed_transition_time]" value="%s" /> in seconds, default 0.3',
|
269 |
isset( $this->options['myfixed_transition_time'] ) ? esc_attr( $this->options['myfixed_transition_time']) : ''
|
270 |
);
|
271 |
+
}
|
272 |
+
|
273 |
+
public function myfixed_disable_small_screen_callback()
|
274 |
+
{
|
275 |
+
printf(
|
276 |
+
'<input id="%1$s" name="mysticky_option_name[myfixed_disable_small_screen]" type="checkbox" %2$s /> Enable mysticky menu on small resolutions, less than 359px, default unchecked.',
|
277 |
+
'myfixed_disable_small_screen',
|
278 |
+
checked( isset( $this->options['myfixed_disable_small_screen'] ), true, false )
|
279 |
+
);
|
280 |
+
}
|
281 |
+
public function myfixed_disable_admin_bar_callback()
|
282 |
+
{
|
283 |
+
printf(
|
284 |
+
'<input id="%1$s" name="mysticky_option_name[myfixed_disable_admin_bar]" type="checkbox" %2$s /> Select this only if your theme does not show fixed admin bar on frontpage, default unchecked.',
|
285 |
+
'myfixed_disable_admin_bar',
|
286 |
+
checked( isset( $this->options['myfixed_disable_admin_bar'] ), true, false )
|
287 |
+
);
|
288 |
+
}
|
289 |
}
|
290 |
|
291 |
if( is_admin() )
|
294 |
// end plugin admin settings
|
295 |
|
296 |
|
297 |
+
// Remove default option for more link that jumps at the midle of page and its covered by menu
|
298 |
|
299 |
function mysticky_remove_more_jump_link($link) {
|
300 |
$offset = strpos($link, '#more-');
|
308 |
}
|
309 |
add_filter('the_content_more_link', 'mysticky_remove_more_jump_link');
|
310 |
|
311 |
+
// Create style from options
|
312 |
|
313 |
function mysticky_build_stylesheet_content() {
|
314 |
$mysticky_options = get_option( 'mysticky_option_name' );
|
315 |
+
echo
|
316 |
+
'<style type="text/css">
|
317 |
+
';
|
318 |
+
if ($mysticky_options ['myfixed_disable_admin_bar'] == false ){
|
319 |
+
echo
|
320 |
+
'#wpadminbar {
|
321 |
position: absolute !important;
|
322 |
top: 0px !important;
|
323 |
}
|
324 |
+
';
|
325 |
+
}
|
326 |
+
echo
|
327 |
+
'.myfixed {
|
328 |
+
position: fixed;
|
329 |
+
top: 0px!important;
|
330 |
+
margin-top: 0px!important;
|
331 |
z-index: '. $mysticky_options ['myfixed_zindex'] .';
|
332 |
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=' . $mysticky_options ['myfixed_opacity'] . ')";
|
333 |
filter: alpha(opacity=' . $mysticky_options ['myfixed_opacity'] . ');
|
334 |
opacity:.' . $mysticky_options ['myfixed_opacity'] . ';
|
335 |
+
';
|
336 |
+
if ($mysticky_options ['myfixed_width'] >= 1 ){
|
337 |
+
echo
|
338 |
+
'width:' . $mysticky_options ['myfixed_width'] . '!important;
|
339 |
+
';
|
340 |
+
}
|
341 |
+
echo
|
342 |
+
'background-color: ' . $mysticky_options ['myfixed_bgcolor'] . '!important;
|
343 |
-webkit-transition: ' . $mysticky_options ['myfixed_transition_time'] . 's;
|
344 |
-moz-transition: ' . $mysticky_options ['myfixed_transition_time'] . 's;
|
345 |
-o-transition: ' . $mysticky_options ['myfixed_transition_time'] . 's;
|
346 |
transition: ' . $mysticky_options ['myfixed_transition_time'] . 's;
|
347 |
}
|
348 |
+
';
|
349 |
+
if ($mysticky_options ['myfixed_disable_small_screen'] == false ){
|
350 |
+
echo
|
351 |
+
'@media (max-width: 359px) {.myfixed {position: static!important;}}
|
352 |
+
';
|
353 |
+
}
|
354 |
+
echo '</style>
|
355 |
+
';
|
356 |
}
|
357 |
add_action('wp_head', 'mysticky_build_stylesheet_content');
|
358 |
|
359 |
|
360 |
function mystickymenu_script() {
|
361 |
|
|
|
362 |
$mysticky_options = get_option( 'mysticky_option_name' );
|
363 |
|
364 |
+
// Register scripts
|
365 |
wp_register_script('mystickymenu', WP_PLUGIN_URL. '/mystickymenu/mystickymenu.js', false,'1.0.0', true);
|
366 |
wp_enqueue_script( 'mystickymenu' );
|
367 |
|
readme.txt
CHANGED
@@ -4,10 +4,10 @@ Donate link: http://wordpress.transformnews.com
|
|
4 |
Tags: sticky menu, twentythirteen, twenty-thirteen, plugin, menu
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 3.8.1
|
7 |
-
Stable tag: 1.
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
-
This lightweight plugin will made your
|
11 |
|
12 |
== Description ==
|
13 |
Plugin is designed for Twentythirteen template but should work on any theme, it's using default twentythirteen ".navbar" css class and that should be modified for other themes if different.
|
@@ -23,6 +23,5 @@ If using template other than Twenty Thirteen go to Settings / myStickymenu and c
|
|
23 |
Original javascript used from http://jsbin.com/omanut/2/edit
|
24 |
|
25 |
== Screenshots ==
|
26 |
-
1. screenshot-1.png
|
27 |
-
2. screenshot-2.png shows menu when page is scrolled towards the bottom.
|
28 |
-
3. screenshot-3.png shows myStickymenu admin settings page.
|
4 |
Tags: sticky menu, twentythirteen, twenty-thirteen, plugin, menu
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 3.8.1
|
7 |
+
Stable tag: 1.3
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
+
This lightweight plugin will made your menu sticky on top of page, after scroll, when selected sticky class hits upper border.
|
11 |
|
12 |
== Description ==
|
13 |
Plugin is designed for Twentythirteen template but should work on any theme, it's using default twentythirteen ".navbar" css class and that should be modified for other themes if different.
|
23 |
Original javascript used from http://jsbin.com/omanut/2/edit
|
24 |
|
25 |
== Screenshots ==
|
26 |
+
1. screenshot-1.png shows administration settings.
|
27 |
+
2. screenshot-2.png shows menu when page is scrolled towards the bottom.
|
|
screenshot-1.png
CHANGED
Binary file
|