Version Description
- 2020-02-01
- bug fixes
- minor GUI improvements
- 100,000 users hit on 2020-01-31
Download this release
Release Info
Developer | WebFactory |
Plugin | Sticky Menu (or Anything!) on Scroll |
Version | 2.2 |
Comparing to | |
See all releases |
Code changes from version 2.1.1 to 2.2
- README.md +0 -247
- assets/css/sticky-anything-admin.css +219 -61
- assets/faq.php +48 -50
- assets/index.php +1 -0
- assets/plugin-info.php +0 -23
- assets/screenshot-1.png +0 -0
- assets/screenshot-2.png +0 -0
- assets/screenshots/screenshot-1.png +0 -0
- assets/screenshots/screenshot-2.png +0 -0
- assets/sidebar.php +15 -0
- readme.txt +22 -22
- sticky-menu-or-anything.php +199 -88
- uninstall.php +4 -3
README.md
DELETED
@@ -1,247 +0,0 @@
|
|
1 |
-
# Sticky Menu (or Anything!) on Scroll
|
2 |
-
* Contributors: senff
|
3 |
-
* Donate link: http://www.senff.com/donate
|
4 |
-
* Tags: sticky header, sticky menu, sticky, header, menu
|
5 |
-
* Plugin URI: http://www.senff.com/plugins/sticky-anything-wp
|
6 |
-
* Requires at least: 3.6
|
7 |
-
* Tested up to: 4.9
|
8 |
-
* Stable tag: 2.1.1
|
9 |
-
* License: GPLv2 or later
|
10 |
-
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
-
|
12 |
-
Sticky Menu (Or Anything) On Scroll will let you choose any element on your page that will be "sticky" at the top once you scroll down.
|
13 |
-
|
14 |
-
## Description
|
15 |
-
|
16 |
-
### Summary
|
17 |
-
|
18 |
-
The Sticky Menu (Or Anything) On Scroll plugin for WordPress allows you to make any element on your pages "sticky" as soon as it hits the top of the page when you scroll down. Although this is commonly used to keep menus at the top of your page, the plugin allows you to make ANY element sticky (such as a Call To Action box, a logo, etc.)
|
19 |
-
|
20 |
-
A little bit of basic HTML/CSS knowledge is required. You just need to know how to pick the right selector for the element you want to make sticky, and you need to be sure it's a unique selector. Sometimes a simple selector like "nav", "#main-menu", ".menu-main-menu-1" is enough. Other times you will have to be more detailed and use a more specific selector such as "header > ul:first-child" or "nav.top .menu-header ul.main".
|
21 |
-
|
22 |
-
### Features
|
23 |
-
|
24 |
-
* **Any element can stick**: although common use is for navigation menus, the plugin will let you pick any unique element with a name, class or ID to stick at the top of the page once you scroll past it. Use it for a sidebar, Call-to-action box, banner ad, etc.
|
25 |
-
* **Positioning from top**: optionally, you can add any amount of space between the sticky element and the top of the page, so that the element is not always stuck at the "ceiling" of the page.
|
26 |
-
* **Enable for certain screen sizes only**: optionally, you can set a minimum and/or maximum screen size where the stickiness should work. This can be handy if you have a responsive site and you don't want your element to be sticky on smaller screens, for example.
|
27 |
-
* **Push-up element**: optionally, you can pick any other element lower on the page that will push the sticky element up again (for example a sidebar widget).
|
28 |
-
* **Admin Bar aware**: checks if the current user has an Admin Toolbar at the top of the page. If it has, the sticky element will not obscure it (or be obscured by it).
|
29 |
-
* **Z-index**: in case there are other elements on the page that obscure or peek through your sticky element, you can add a Z-index easily.
|
30 |
-
* **Legacy Mode**: in 2.0, a new method of making things sticky was introduced. In Legacy Mode, the old method will be used. See FAQ for details.
|
31 |
-
* **Dynamic Mode**: some issues that frequently appear in responsive themes have been address by adding a Dynamic Mode (Legacy Mode only). See FAQ for details.
|
32 |
-
* **Debug Mode:** find out possible reasons why your element doesn't stick by switching on Debug Mode, and error messages will appear in your browser's console.
|
33 |
-
|
34 |
-
|
35 |
-
## Installation
|
36 |
-
|
37 |
-
1. Upload the "sticky-menu-or-anything" directory to your "wp-content/plugins" directory.
|
38 |
-
2. In your WordPress admin, go to PLUGINS and activate "Sticky Menu (or Anything!)"
|
39 |
-
3. Go to SETTINGS - STICKY MENU (OR ANYTHING!)
|
40 |
-
4. Pick the element you want to make sticky
|
41 |
-
5. Party!
|
42 |
-
|
43 |
-
## Frequently Asked Questions
|
44 |
-
|
45 |
-
### I selected a class/ID in the settings screen, but the element doesn't stick when I scroll down. Why not?
|
46 |
-
First, make sure that if you select the element by its classname, it is preceded by a dot (e.g. `.main-menu`), and if you select it by its ID, that it's preceded by a pound/hash/number sign (e.g. `#main-menu`). Also, make sure there is only ONE element on the page with the selector you're using. If there is none, or more than one element that matches your selector, nothing will happen.
|
47 |
-
|
48 |
-
### Once the element becomes sticky, it's not positioned/sized properly at all.
|
49 |
-
Due to the nature of CSS, there are situations where an element will not stick properly, usually if it has specific properties that are used to manipulate its location and/or dimensions. If your sticky element has any of the following properties, this could cause conflicts:
|
50 |
-
|
51 |
-
- negative margins
|
52 |
-
- absolute positioning
|
53 |
-
- top/left/bottom/right properties
|
54 |
-
- `display: inline`
|
55 |
-
- `!important` applied to any of its properties
|
56 |
-
|
57 |
-
Try to avoid all this where possible, but if you can't, using the plugin in Legacy Mode (see below) helps sometimes.
|
58 |
-
Another situation that can cause trouble, is when any parent of your sticky element has the `transform` CSS property applied to it.
|
59 |
-
|
60 |
-
### Once the element becomes sticky, it's not responsive and doesn't resize when I change the browser size.
|
61 |
-
This is a known (and annoying) bug in the plugin that I haven't been able to solve properly yet. For some sites (when the element does not contain any Javascript interactivity, usually), it sometimes helps to use the plugin in Legacy Mode (see below).
|
62 |
-
|
63 |
-
### Is it possible to add some styles to the element but only when it's sticky?
|
64 |
-
To add styles to your sticky element when it's not sticky, use classname `.element-is-not-sticky`.
|
65 |
-
To add styles to your sticky element only when it's sticky, use classname `.element-is-sticky`.
|
66 |
-
|
67 |
-
The following code would give your element a red background when it's not sticky, and blue when it is:
|
68 |
-
|
69 |
-
```
|
70 |
-
.element-is-not-sticky {
|
71 |
-
background: red;
|
72 |
-
}
|
73 |
-
|
74 |
-
.element-is-sticky {
|
75 |
-
background: blue;
|
76 |
-
}
|
77 |
-
```
|
78 |
-
|
79 |
-
### Once the element becomes sticky, there's a brief moment where you see it twice.
|
80 |
-
If you're using the plugin in Legacy Mode (see below), this happens when the sticky element (or any of its contents) has a CSS transition applied to it. Because the original element becomes invisible (and a cloned copy of it becomes visible), the visible-to-invisible status change will take place with a transition (ie. not instantly). Either remove any of the transitions the element has, or try disabling the Legacy Mode.
|
81 |
-
|
82 |
-
### My menu sticks, but it doesn't open on the Responsive theme when it's sticky.
|
83 |
-
This was a bug in pre-2.0 versions, and an incompatibility with the theme. It has been fixed in 2.0, but in Legacy Mode, this bug is still present. If you need to enable Legacy Mode for some reason, it would be better to turn off stickiness for the mobile menu (set "Do not stick element when screen smaller than:" to 651 pixels).
|
84 |
-
|
85 |
-
### I have another plugin called Easy Smooth Scroll Links, but once my menu becomes sticky, that one doesn't work anymore.
|
86 |
-
This was a bug in pre-2.0 versions, and an incompatibility with the plugin. It has been fixed in 2.0, but in Legacy Mode, this bug is still present. If you need Legacy Mode enabled for some reason, there is no fix for this bug, however there is an alternative workaround. According to reports from users who had this issue, a plugin called Page Scroll To ID is a worthy alternative to Easy Smooth Scroll Links and works with the Sticky Anything plugin in Legacy Mode.
|
87 |
-
|
88 |
-
### Still doesn't work. What could be wrong?
|
89 |
-
Check the "Debug Mode" checkbox in the plugin's settings. Reload the page and you may see errors in your browser's console window. If you've used a selector that doesn't exist, OR there are more of them on the page, you will be notified of that in the console.
|
90 |
-
|
91 |
-
### Is it possible to have multiple sticky elements?
|
92 |
-
The current version only allows one sticky element, but this functionality will be implemented in the next major version. No expected release date, though.
|
93 |
-
|
94 |
-
### What is Legacy Mode? Should I use it?
|
95 |
-
In version 2.0 of the plugin, a new/better method for making elements sticky was introduced. Before this, a sticky element would essentially be a cloned copy of the original element. Now, the element itself becomes sticky and doesn't use copying and cloning anymore, which solves a lot of issues.
|
96 |
-
|
97 |
-
So, should you use it or not? Well, if you upgraded this plugin from an earlier version, Legacy Mode will be turned ON by default, because chances are that the old method worked perfectly fine for your site. If that's the case, there is not really a need to use the new method and you can just continue using the old, classic method. If it ain't broke, don't fix it, right?
|
98 |
-
|
99 |
-
Having said that, it's worth checking if your element works just as well with Legacy Mode turned OFF, since this is the "better" method. Just give it a quick try. If it doesn't work, you can always just go back and enable it again.
|
100 |
-
|
101 |
-
NOTE: new installs of the plugin will have the Legacy Mode turned off by default. Only UPGRADES from 1.4 (or before) should have it turned on by default.
|
102 |
-
|
103 |
-
### What is this Dynamic Mode thing exactly?
|
104 |
-
This mode is only available in Legacy Mode, and to properly explain this, we'll need to go a little deeper in the plugin's functionality. So bear with me...
|
105 |
-
|
106 |
-
In Legacy Mode, when an element becomes sticky at the top of the page (and keeps its place regardless of the scrolling), it's actually not the element itself you see, but a cloned copy of it, while the actuak original element is out of view and invisible.
|
107 |
-
|
108 |
-
The original element always stays where it originally is on the page, while the cloned element is always at the top of the browser viewport screen. However, you will never see them both at the same time; depending on your scroll position, it always just shows either one or the other.
|
109 |
-
|
110 |
-
In the original plugin version, the clone would be created right the moment when you load the page (but not visible right away). Then when you would scroll down, it would become visible (and stick at the top), while the original element would disappear from view.
|
111 |
-
|
112 |
-
However, some themes use JavaScript to dynamically create elements (menus, mostly) for mobile sites. With this method, a menu doesn't exist in the HTML source code when you load the page, but is created some time after the page is fully loaded -- in many cases, these menus would just be generated ONLY when the screen is more (or less) than a certain specific width. With the original version of the plugin, the problem would be that the original element (that you want to make sticky) may not have been fully created upon page load, so the clone would also not be fully functional.
|
113 |
-
|
114 |
-
Enter Dynamic Mode. Now, a clone of the element is not created on page load -- instead, it's only created when the user scrolls and hits the "sticky" point. This ensures that the cloned element is an actual 1-on-1 copy of what the original element consists of at that specific point in time (and not at the "page is loaded" point, which may be different if the element was altered since).
|
115 |
-
|
116 |
-
Why don't we use Dynamic Mode all the time then? This has to do with the fact that other plugins initialize themselves on page load and may need the full markup (including the cloned element) at that point. In Dynamic Mode, there is no clone available yet on page load, so that could cause an issue if that other plugin is looking for an element that doesn't exist yet.
|
117 |
-
|
118 |
-
(This may all sound terribly confusing. And it is! So, much work was done to fix this nonsense: since v2.0 of the plugin, a whole different method is being used to make elements sticky, and Dynamic Mode is not even an issue anymore.)
|
119 |
-
|
120 |
-
Phew!
|
121 |
-
|
122 |
-
### I'll need more help please!
|
123 |
-
Please go to the plugin's [support forum on WordPress.org](https://wordpress.org/support/plugin/sticky-menu-or-anything-on-scroll) and post a message (include a link to your site if possible). Response time is usually within a few hours maximum.
|
124 |
-
|
125 |
-
### I need some functionality that the plugin currently doesn't support. Can you help make a custom version?
|
126 |
-
If the customization is fairly minor, I can probably help out right away. However, if the requested customization is of a more complex nature, I won't be able to do it quickly/free and it may take a number of hours. If you're interested in that, please go to the plugin's [support forum on WordPress.org](https://wordpress.org/support/plugin/sticky-menu-or-anything-on-scroll) and let me know that you'll need some custom work (include a link to your site if possible).
|
127 |
-
|
128 |
-
|
129 |
-
## Screenshots
|
130 |
-
|
131 |
-
1. Basic settings screen
|
132 |
-
2. Advanced settings screen
|
133 |
-
|
134 |
-
|
135 |
-
## Changelog
|
136 |
-
|
137 |
-
### 2.1.1
|
138 |
-
* Fixed minification bug
|
139 |
-
|
140 |
-
### 2.1
|
141 |
-
* Sticky element has specific classes to target sticky/non-sticky state: ".element-is-sticky" and ".element-is-not-sticky"
|
142 |
-
|
143 |
-
### 2.0.1
|
144 |
-
* fixed padding calculation bug (percentages are off when sticky)
|
145 |
-
* fixed bug where assigned styles loop caused JS error
|
146 |
-
|
147 |
-
### 2.0
|
148 |
-
* Introduced a new/better method for making elements sticky
|
149 |
-
* Added Legacy Mode (for those who want to continue the old method)
|
150 |
-
* Split up settings screen in Basic and Advanced
|
151 |
-
* Debug mode uses uncompressed JS file for easier remote debugging
|
152 |
-
|
153 |
-
### 1.4
|
154 |
-
* Removed error notification if no pushup-element is selected
|
155 |
-
* Renaming class "cloned" to "sticky-element-cloned" and "original" to "sticky-element-original" to avoid conflicts with Owl Carousel
|
156 |
-
* Fixed bug where cloned element width would be rounded down if it contained sub-pixels
|
157 |
-
|
158 |
-
### 1.3.1
|
159 |
-
* Minor bug fix for push-up element
|
160 |
-
|
161 |
-
### 1.3
|
162 |
-
* Added functionality to move sticky element down in case there is an Administrator Toolbar at the top of the page
|
163 |
-
* Added functionality to push sticky element up by another element lower down the page
|
164 |
-
|
165 |
-
### 1.2.4
|
166 |
-
* Fixed small bug related to version number
|
167 |
-
|
168 |
-
### 1.2.3
|
169 |
-
* Bug with Dynamic Mode select box/label fixed
|
170 |
-
* Bug with Z-index fixed (thanks @aguseo for reporting)
|
171 |
-
* All text in plugin fully translatable
|
172 |
-
* Added FAQ tab to settings screen
|
173 |
-
* Added infobox to settings screen
|
174 |
-
* Added a few comments to source code
|
175 |
-
|
176 |
-
### 1.2
|
177 |
-
* Dynamic Mode added (addressing problems with dynamically created menus -- see Frequently Asked Questions above for details)
|
178 |
-
|
179 |
-
### 1.1.4
|
180 |
-
* Ready for WordPress 4.1 (and TwentyFifteen)
|
181 |
-
* Fixes issue when element has padding in percentages
|
182 |
-
|
183 |
-
### 1.1.3
|
184 |
-
* Fixes width calculation bug introduced in previous version (sorry about that), box sizing now supported
|
185 |
-
|
186 |
-
### 1.1.2
|
187 |
-
* Fixes element width calculation bug
|
188 |
-
|
189 |
-
### 1.1.1
|
190 |
-
* Fixes viewport calculation bug
|
191 |
-
|
192 |
-
### 1.1
|
193 |
-
* Added functionality for optional minimum/maximum screen size
|
194 |
-
|
195 |
-
### 1.0
|
196 |
-
* Initial release (using v1.1 of the standalone jQuery plugin)
|
197 |
-
|
198 |
-
|
199 |
-
## Upgrade Notice
|
200 |
-
|
201 |
-
## 2.1.1
|
202 |
-
* Bug fixes
|
203 |
-
|
204 |
-
## 2.1
|
205 |
-
* Functionality for targeting sticky/non-sticky classnames added
|
206 |
-
|
207 |
-
## 2.0.1
|
208 |
-
* A few small bug fixes
|
209 |
-
|
210 |
-
## 2.0
|
211 |
-
* Bug fixes and new/better method of making elements sticky
|
212 |
-
|
213 |
-
## 1.4
|
214 |
-
* Couple of bug fixes
|
215 |
-
|
216 |
-
### 1.3.1
|
217 |
-
* Minor bug fix for push-up element
|
218 |
-
|
219 |
-
### 1.3
|
220 |
-
* BY POPULAR DEMAND: functionalities added related to Administrator Toolbar and element that can push sticky element up
|
221 |
-
|
222 |
-
### 1.2.4
|
223 |
-
* Minor bugfix
|
224 |
-
|
225 |
-
### 1.2.3
|
226 |
-
* Bugfixes, improvements and translation-ready
|
227 |
-
|
228 |
-
### 1.2
|
229 |
-
* Dynamic Mode added
|
230 |
-
|
231 |
-
### 1.1.4
|
232 |
-
* Bugfixes, ready for WordPress 4.1 (and TwentyFifteen)
|
233 |
-
|
234 |
-
### 1.1.3
|
235 |
-
* Bugfix for new bug introduced in 1.1.2
|
236 |
-
|
237 |
-
### 1.1.2
|
238 |
-
* Bugfixes
|
239 |
-
|
240 |
-
### 1.1.1
|
241 |
-
* Bugfixes
|
242 |
-
|
243 |
-
### 1.1
|
244 |
-
* Added functionality (minimum and/or maximum screen size)
|
245 |
-
|
246 |
-
### 1.0
|
247 |
-
* Initial release of the plugin
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/css/sticky-anything-admin.css
CHANGED
@@ -1,113 +1,271 @@
|
|
1 |
.hide {
|
2 |
-
|
3 |
}
|
4 |
|
5 |
.main-content {
|
6 |
-
|
7 |
-
|
8 |
}
|
9 |
|
10 |
.main-content .new-feature {
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
}
|
16 |
|
17 |
.main-content .form-table .disabled-feature {
|
18 |
-
|
19 |
}
|
20 |
|
21 |
.main-content .form-table .disabled-feature input,
|
22 |
.main-content .form-table .disabled-feature label {
|
23 |
-
|
24 |
}
|
25 |
|
26 |
-
|
27 |
.main-content .new-feature th,
|
28 |
.main-content .new-feature td {
|
29 |
-
|
30 |
}
|
31 |
|
32 |
.main-content .new,
|
33 |
.main-content .solved {
|
34 |
-
|
35 |
-
|
36 |
}
|
37 |
|
38 |
-
.main-content input[type=
|
39 |
-
|
40 |
}
|
41 |
|
42 |
.main-content .tab-sticky-advanced textarea {
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
}
|
48 |
|
49 |
.tab-sticky-faq p {
|
50 |
-
|
51 |
-
|
52 |
}
|
53 |
|
54 |
.tab-sticky-faq strong {
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
}
|
61 |
|
62 |
.tab-sticky-faq p:nth-of-type(1) strong {
|
63 |
-
|
64 |
}
|
65 |
|
66 |
.main-sidebar {
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
|
|
|
|
72 |
}
|
73 |
|
74 |
.main-sidebar h3 {
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
}
|
79 |
|
80 |
.main-sidebar .inner {
|
81 |
-
|
82 |
}
|
83 |
|
84 |
.main-sidebar p {
|
85 |
-
|
86 |
-
|
87 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
}
|
89 |
|
|
|
|
|
|
|
90 |
|
91 |
@media screen and (max-width: 782px) {
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
.hide {
|
2 |
+
display: none;
|
3 |
}
|
4 |
|
5 |
.main-content {
|
6 |
+
float: left;
|
7 |
+
width: 70%;
|
8 |
}
|
9 |
|
10 |
.main-content .new-feature {
|
11 |
+
border: solid 1px #c0c0c0;
|
12 |
+
background: #e7e7e7;
|
13 |
+
border-right: solid 1px #fff;
|
14 |
+
border-bottom: solid 1px #fff;
|
15 |
}
|
16 |
|
17 |
.main-content .form-table .disabled-feature {
|
18 |
+
opacity: 0.65;
|
19 |
}
|
20 |
|
21 |
.main-content .form-table .disabled-feature input,
|
22 |
.main-content .form-table .disabled-feature label {
|
23 |
+
cursor: default;
|
24 |
}
|
25 |
|
|
|
26 |
.main-content .new-feature th,
|
27 |
.main-content .new-feature td {
|
28 |
+
padding-left: 10px;
|
29 |
}
|
30 |
|
31 |
.main-content .new,
|
32 |
.main-content .solved {
|
33 |
+
font-weight: bold;
|
34 |
+
color: #e00;
|
35 |
}
|
36 |
|
37 |
+
.main-content input[type='text'] {
|
38 |
+
width: 200px;
|
39 |
}
|
40 |
|
41 |
.main-content .tab-sticky-advanced textarea {
|
42 |
+
font-family: courier new;
|
43 |
+
font-size: 12px;
|
44 |
+
height: 140px;
|
45 |
+
overflow-y: scroll;
|
46 |
}
|
47 |
|
48 |
.tab-sticky-faq p {
|
49 |
+
font-size: 14px;
|
50 |
+
margin-bottom: 20px;
|
51 |
}
|
52 |
|
53 |
.tab-sticky-faq strong {
|
54 |
+
color: #222;
|
55 |
+
padding-top: 20px;
|
56 |
+
margin-bottom: 3px;
|
57 |
+
border-top: solid 1px #ccc;
|
58 |
+
display: block;
|
59 |
}
|
60 |
|
61 |
.tab-sticky-faq p:nth-of-type(1) strong {
|
62 |
+
border-top: none;
|
63 |
}
|
64 |
|
65 |
.main-sidebar {
|
66 |
+
float: right;
|
67 |
+
width: 25%;
|
68 |
+
background: #ffffff;
|
69 |
+
border: 1px solid #e5e5e5;
|
70 |
+
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
|
71 |
+
padding: 10px;
|
72 |
+
font-size: 14px;
|
73 |
}
|
74 |
|
75 |
.main-sidebar h3 {
|
76 |
+
margin: 0;
|
77 |
+
padding: 8px 12px;
|
78 |
+
border-bottom: 1px solid #ececec;
|
79 |
}
|
80 |
|
81 |
.main-sidebar .inner {
|
82 |
+
padding: 10px;
|
83 |
}
|
84 |
|
85 |
.main-sidebar p {
|
86 |
+
padding: 8px;
|
87 |
+
margin: 0;
|
88 |
+
}
|
89 |
+
|
90 |
+
.tab-content {
|
91 |
+
margin: 0 20px;
|
92 |
+
}
|
93 |
+
|
94 |
+
.form-table th {
|
95 |
+
width: 260px;
|
96 |
+
}
|
97 |
+
|
98 |
+
.wrap .notice-rate {
|
99 |
+
padding: 10px 10px;
|
100 |
+
width: 650px;
|
101 |
+
margin: 20px 0;
|
102 |
+
}
|
103 |
+
|
104 |
+
.wrap .notice-rate p {
|
105 |
+
font-size: 14px;
|
106 |
}
|
107 |
|
108 |
+
#message {
|
109 |
+
width: 650px;
|
110 |
+
}
|
111 |
|
112 |
@media screen and (max-width: 782px) {
|
113 |
+
.main-content,
|
114 |
+
.main-sidebar {
|
115 |
+
width: 100%;
|
116 |
+
float: none;
|
117 |
+
clear: both;
|
118 |
+
}
|
119 |
+
|
120 |
+
.main-content .new-feature {
|
121 |
+
border: none;
|
122 |
+
background: transparent;
|
123 |
+
}
|
124 |
+
|
125 |
+
.main-content .new-feature th,
|
126 |
+
.main-content .new-feature td {
|
127 |
+
padding-left: 0;
|
128 |
+
}
|
129 |
+
|
130 |
+
.main-content td {
|
131 |
+
padding-bottom: 20px;
|
132 |
+
border-bottom: dashed 1px #c0c0c0;
|
133 |
+
}
|
134 |
+
}
|
135 |
+
|
136 |
+
[tooltip] {
|
137 |
+
position: relative;
|
138 |
+
}
|
139 |
+
|
140 |
+
[tooltip]::before,
|
141 |
+
[tooltip]::after {
|
142 |
+
text-transform: none;
|
143 |
+
line-height: 1;
|
144 |
+
user-select: none;
|
145 |
+
pointer-events: none;
|
146 |
+
position: absolute;
|
147 |
+
display: none;
|
148 |
+
opacity: 0;
|
149 |
+
}
|
150 |
+
[tooltip]::before {
|
151 |
+
content: '';
|
152 |
+
_border: 5px solid transparent;
|
153 |
+
z-index: 1001;
|
154 |
+
}
|
155 |
+
[tooltip]::after {
|
156 |
+
content: attr(tooltip);
|
157 |
+
text-align: center;
|
158 |
+
line-height: 1.5;
|
159 |
+
font-size: 15px;
|
160 |
+
min-width: 3em;
|
161 |
+
max-width: 21em;
|
162 |
+
_white-space: nowrap;
|
163 |
+
_overflow: hidden;
|
164 |
+
width: 250px;
|
165 |
+
text-overflow: ellipsis;
|
166 |
+
padding: 1ch 1.5ch;
|
167 |
+
border-radius: 0.3ch;
|
168 |
+
box-shadow: 0 1em 2em -0.5em rgba(0, 0, 0, 0.35);
|
169 |
+
background: #333;
|
170 |
+
color: #fff;
|
171 |
+
z-index: 1000;
|
172 |
+
}
|
173 |
+
|
174 |
+
[tooltip]:hover::before,
|
175 |
+
[tooltip]:hover::after {
|
176 |
+
display: block;
|
177 |
+
}
|
178 |
+
|
179 |
+
[tooltip='']::before,
|
180 |
+
[tooltip='']::after {
|
181 |
+
display: none !important;
|
182 |
+
}
|
183 |
+
|
184 |
+
[tooltip]:not([flow])::before,
|
185 |
+
[tooltip][flow^='up']::before {
|
186 |
+
bottom: 100%;
|
187 |
+
border-bottom-width: 0;
|
188 |
+
border-top-color: #333;
|
189 |
+
}
|
190 |
+
[tooltip]:not([flow])::after,
|
191 |
+
[tooltip][flow^='up']::after {
|
192 |
+
bottom: calc(100% + 5px);
|
193 |
+
}
|
194 |
+
[tooltip]:not([flow])::before,
|
195 |
+
[tooltip]:not([flow])::after,
|
196 |
+
[tooltip][flow^='up']::before,
|
197 |
+
[tooltip][flow^='up']::after {
|
198 |
+
left: 50%;
|
199 |
+
transform: translate(-50%, -0.5em);
|
200 |
+
}
|
201 |
+
|
202 |
+
[tooltip][flow^='down']::before {
|
203 |
+
top: 100%;
|
204 |
+
border-top-width: 0;
|
205 |
+
border-bottom-color: #333;
|
206 |
+
}
|
207 |
+
[tooltip][flow^='down']::after {
|
208 |
+
top: calc(100% + 5px);
|
209 |
+
}
|
210 |
+
[tooltip][flow^='down']::before,
|
211 |
+
[tooltip][flow^='down']::after {
|
212 |
+
left: 50%;
|
213 |
+
transform: translate(-50%, 0.5em);
|
214 |
+
}
|
215 |
+
|
216 |
+
[tooltip][flow^='left']::before {
|
217 |
+
top: 50%;
|
218 |
+
border-right-width: 0;
|
219 |
+
border-left-color: #333;
|
220 |
+
left: calc(0em - 5px);
|
221 |
+
transform: translate(-0.5em, -50%);
|
222 |
+
}
|
223 |
+
[tooltip][flow^='left']::after {
|
224 |
+
top: 50%;
|
225 |
+
right: calc(100% + 5px);
|
226 |
+
transform: translate(-0.5em, -50%);
|
227 |
+
}
|
228 |
+
|
229 |
+
[tooltip][flow^='right']::before {
|
230 |
+
top: 50%;
|
231 |
+
border-left-width: 0;
|
232 |
+
border-right-color: #333;
|
233 |
+
right: calc(0em - 5px);
|
234 |
+
transform: translate(0.5em, -50%);
|
235 |
+
}
|
236 |
+
[tooltip][flow^='right']::after {
|
237 |
+
top: 50%;
|
238 |
+
left: calc(100% + 5px);
|
239 |
+
transform: translate(0.5em, -50%);
|
240 |
+
}
|
241 |
+
|
242 |
+
@keyframes tooltips-vert {
|
243 |
+
to {
|
244 |
+
opacity: 0.9;
|
245 |
+
transform: translate(-50%, 0);
|
246 |
+
}
|
247 |
+
}
|
248 |
+
|
249 |
+
@keyframes tooltips-horz {
|
250 |
+
to {
|
251 |
+
opacity: 0.9;
|
252 |
+
transform: translate(0, -50%);
|
253 |
+
}
|
254 |
+
}
|
255 |
+
|
256 |
+
/* FX All The Things */
|
257 |
+
[tooltip]:not([flow]):hover::before,
|
258 |
+
[tooltip]:not([flow]):hover::after,
|
259 |
+
[tooltip][flow^='up']:hover::before,
|
260 |
+
[tooltip][flow^='up']:hover::after,
|
261 |
+
[tooltip][flow^='down']:hover::before,
|
262 |
+
[tooltip][flow^='down']:hover::after {
|
263 |
+
animation: tooltips-vert 300ms ease-out forwards;
|
264 |
+
}
|
265 |
+
|
266 |
+
[tooltip][flow^='left']:hover::before,
|
267 |
+
[tooltip][flow^='left']:hover::after,
|
268 |
+
[tooltip][flow^='right']:hover::before,
|
269 |
+
[tooltip][flow^='right']:hover::after {
|
270 |
+
animation: tooltips-horz 300ms ease-out forwards;
|
271 |
+
}
|
assets/faq.php
CHANGED
@@ -1,50 +1,48 @@
|
|
1 |
-
<
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
<p><?php _e('
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
<p><?php _e('
|
36 |
-
<p><?php _e('
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
<p><?php _e('
|
42 |
-
<p><?php _e('
|
43 |
-
<p><?php _e('
|
44 |
-
<p><?php _e('
|
45 |
-
<p><?php _e('
|
46 |
-
<p><?php _e('
|
47 |
-
<p><?php _e('
|
48 |
-
|
49 |
-
<p><strong><?php _e('Q: I\'ll need more help please!','Sticky Anything plugin'); ?></strong><br />
|
50 |
-
<?php _e('<!-- The plugin\'s own page can be found at <a href="http://www.senff.com/plugins/sticky-anything-wp" target="_blank">http://www.senff.com/plugins/sticky-anything-wp</a>. If that still doesn\'t help you solve your issue, please do NOT file a bug through the form on my website, but instead --> Please go to the plugin\'s <a href="https://wordpress.org/support/plugin/sticky-menu-or-anything-on-scroll" target="_blank">support forum on WordPress.org</a> and post a message (include a link to your site if possible). Repsonse time is usually within a few hours maximum.','Sticky Anything plugin'); ?></p>
|
1 |
+
<p><strong><?php _e('Q: I need help please!','sticky-menu-or-anything-on-scroll'); ?></strong><br />
|
2 |
+
<?php _e('Please read the FAQ below first and then go to the plugin\'s <a href="https://wordpress.org/support/plugin/sticky-menu-or-anything-on-scroll" target="_blank">support forum on WordPress.org</a> and post a message (include a link to your site if possible). Average response time is a few hours.','sticky-menu-or-anything-on-scroll'); ?></p>
|
3 |
+
|
4 |
+
<p><strong><?php _e('Q: I selected a class/ID in the settings screen, but the element doesn\'t stick when I scroll down. Why not?','sticky-menu-or-anything-on-scroll'); ?></strong><br />
|
5 |
+
<?php _e('First, make sure that if you select the element by its classname, it is preceded by a dot (e.g. ".main-menu"), and if you select it by its ID, that it\'s preceded by a pound/hash/number sign (e.g. "#main-menu"). Also, make sure there is only ONE element on the page with the selector you\'re using. If there is none, or more than one element that matches your selector, nothing will happen.','sticky-menu-or-anything-on-scroll'); ?></p>
|
6 |
+
|
7 |
+
<p><strong><?php _e('Q: Once the element becomes sticky, it\'s not positioned/sized properly at all.','sticky-menu-or-anything-on-scroll'); ?></strong><br />
|
8 |
+
<?php _e('Due to the nature of CSS, there are situations where an element will not stick properly, usually if it has specific properties that are used to manipulate its location and/or dimensions. If your sticky element has any of the following properties, this could cause conflicts:</p><ul><li>- negative margins</li><li>- absolute positioning</li><li>- top/left/bottom/right properties</li><li>- "display: inline"</li><li>- "!important" applied to any of its properties</li></ul><p>Try to avoid all this where possible, but if you can\'t, using the plugin in Legacy Mode (see below) helps sometimes.<br>Another situation that can cause trouble, is when any parent of your sticky element has the "transform" CSS property applied to it.','sticky-menu-or-anything-on-scroll'); ?></p>
|
9 |
+
|
10 |
+
<p><strong><?php _e('Q: Once the element becomes sticky, it\'s not responsive and doesn\'t resize when I change the browser size.','sticky-menu-or-anything-on-scroll'); ?></strong><br />
|
11 |
+
<?php _e('This is a known (and annoying) bug in the plugin that I haven\'t been able to solve properly yet. For some sites (when the element does not contain any Javascript interactivity, usually), it sometimes helps to use the plugin in Legacy Mode (see below).','sticky-menu-or-anything-on-scroll'); ?></p>
|
12 |
+
|
13 |
+
<p><strong><?php _e('Q: Is it possible to add some styles to the element but <em>only</em> when it\'s sticky?','sticky-menu-or-anything-on-scroll'); ?></strong><br />
|
14 |
+
<?php _e('To add styles to your sticky element when it\'s <em>not sticky</em>, use classname ".element-is-not-sticky".<br>To add styles to your sticky element <em>only</em> when it\'s sticky, use classname ".element-is-sticky".','sticky-menu-or-anything-on-scroll'); ?></p>
|
15 |
+
<p><?php _e('The following code would give your element a red background only when it\'s not sticky, and blue only when it is:','sticky-menu-or-anything-on-scroll'); ?></p>
|
16 |
+
<p><?php _e('<code>.element-is-not-sticky {<br> background: red;<br> }<br><br>.element-is-sticky {<br> background: blue;<br> }</code>','sticky-menu-or-anything-on-scroll'); ?></p>
|
17 |
+
|
18 |
+
<p><strong><?php _e('Q: Once the element becomes sticky, there\'s a brief moment where you see it twice.','sticky-menu-or-anything-on-scroll'); ?></strong><br />
|
19 |
+
<?php _e('If you\'re using the plugin in Legacy Mode (see below), this happens when the sticky element (or any of its contents) has a CSS transition applied to it. Because the original element becomes invisible (and a cloned copy of it becomes visible), the visible-to-invisible status change will take place with a transition (ie. not instantly). Either remove any of the transitions the element has, or try disabling the Legacy Mode.','sticky-menu-or-anything-on-scroll'); ?></p>
|
20 |
+
|
21 |
+
<p><strong><?php _e('Q: My menu sticks, but it doesn\'t open on the <a href="https://wordpress.org/themes/responsive" target="_blank">Responsive</a> theme when it\'s sticky.','sticky-menu-or-anything-on-scroll'); ?></strong><br />
|
22 |
+
<?php _e('This was a bug in pre-2.0 versions, and an incompatibility with the theme. It has been fixed in 2.0, but in Legacy Mode, this bug is still present. If you need to enable Legacy Mode for some reason, it would be better to turn off stickiness for the mobile menu (set "Do not stick element when screen smaller than:" to 651 pixels).','sticky-menu-or-anything-on-scroll'); ?></p>
|
23 |
+
|
24 |
+
<p><strong><?php _e('Q: I have another plugin called <a href="https://wordpress.org/plugins/easy-smooth-scroll-links/" target="_blank">Easy Smooth Scroll Links</a>, but once my menu becomes sticky, that one doesn\'t work anymore.','sticky-menu-or-anything-on-scroll'); ?></strong><br />
|
25 |
+
<?php _e('This was a bug in pre-2.0 versions, and an incompatibility with the plugin. It has been fixed in 2.0, but in Legacy Mode, this bug is still present. If you need Legacy Mode enabled for some reason, there is no fix for this bug.','sticky-menu-or-anything-on-scroll'); ?></p>
|
26 |
+
|
27 |
+
<p><strong><?php _e('Q: Still doesn\'t work. What could be wrong?','sticky-menu-or-anything-on-scroll'); ?></strong><br />
|
28 |
+
<?php _e('Check the "Debug Mode" checkbox in the plugin\'s settings. Reload the page and you may see errors in your browser\'s console window. If you\'ve used a selector that doesn\'t exist, OR there are more of them on the page, you will be notified of that in the console.','sticky-menu-or-anything-on-scroll'); ?></p>
|
29 |
+
|
30 |
+
<p><strong><?php _e('Q: Is it possible to have multiple sticky elements?','sticky-menu-or-anything-on-scroll'); ?></strong><br />
|
31 |
+
<?php _e('The current version only allows one sticky element, but this functionality will be implemented in the next major version. No expected release date, though.','sticky-menu-or-anything-on-scroll'); ?></p>
|
32 |
+
|
33 |
+
<p><strong><?php _e('Q: What is Legacy Mode? Should I use it?','sticky-menu-or-anything-on-scroll'); ?></strong><br />
|
34 |
+
<?php _e('In version 2.0 of the plugin, a new/better method for making elements sticky was introduced. Before this, a sticky element would essentially be a cloned copy of the original element. Now, the element itself becomes sticky and doesn\'t use copying and cloning anymore, which solves a lot of issues.','sticky-menu-or-anything-on-scroll'); ?></p>
|
35 |
+
<p><?php _e('So, should you use it or not? Well, if you <em>upgraded</em> this plugin from an earlier version, Legacy Mode will be turned ON by default, because chances are that the old method worked perfectly fine for your site. If that\'s the case, there is not really a need to use the new method and you can just continue using the old, classic method. If it ain\'t broke, don\'t fix it, right?','sticky-menu-or-anything-on-scroll'); ?></p>
|
36 |
+
<p><?php _e('Having said that, it\'s worth checking if your element works just as well with Legacy Mode turned OFF, since this is the "better" method. Just give it a quick try. If it doesn\'t work, you can always just go back and enable it again.','sticky-menu-or-anything-on-scroll'); ?></p>
|
37 |
+
<p><?php _e('<span style="font-weight:bold;">NOTE: new installs of the plugin will have the Legacy Mode turned off by default. Only UPGRADES from 1.4 (or before) should have it turned on by default.</span>','sticky-menu-or-anything-on-scroll'); ?></p>
|
38 |
+
|
39 |
+
<p><strong><?php _e('Q: What is this Dynamic Mode thing exactly?','sticky-menu-or-anything-on-scroll'); ?></strong><br />
|
40 |
+
<?php _e('This mode is only available in Legacy Mode, and to properly explain this, we\'ll need to go a little deeper in the plugin\'s functionality. So bear with me...','sticky-menu-or-anything-on-scroll'); ?></p>
|
41 |
+
<p><?php _e('In Legacy Mode, when an element becomes sticky at the top of the page (and keeps its place regardless of the scrolling), it\'s actually not the element itself you see, but a cloned copy of it, while the actuak original element is out of view and invisible.','sticky-menu-or-anything-on-scroll'); ?></p>
|
42 |
+
<p><?php _e('The original element always stays where it originally is on the page, while the cloned element is always at the top of the browser viewport screen. However, you will never see them both at the same time; depending on your scroll position, it always just shows either one or the other.','sticky-menu-or-anything-on-scroll'); ?></p>
|
43 |
+
<p><?php _e('In the original plugin version, the clone would be created right the moment when you load the page (but not visible right away). Then when you would scroll down, it would become visible (and stick at the top), while the original element would disappear from view.','sticky-menu-or-anything-on-scroll'); ?></p>
|
44 |
+
<p><?php _e('However, some themes use JavaScript to dynamically create elements (menus, mostly) for mobile sites. With this method, a menu doesn\'t exist in the HTML source code when you load the page, but is created some time after the page is fully loaded -- in many cases, these menus would just be generated ONLY when the screen is more (or less) than a certain specific width. With the original version of the plugin, the problem would be that the original element (that you want to make sticky) may not have been fully created upon page load, so the clone would also not be fully functional.','sticky-menu-or-anything-on-scroll'); ?></p>
|
45 |
+
<p><?php _e('Enter Dynamic Mode. Now, a clone of the element is not created on page load -- instead, it\'s only created when the user scrolls and hits the "sticky" point. This ensures that the cloned element is an actual 1-on-1 copy of what the original element consists of at that specific point in time (and not at the "page is loaded" point, which may be different if the element was altered since).','sticky-menu-or-anything-on-scroll'); ?></p>
|
46 |
+
<p><?php _e('Why don\'t we use Dynamic Mode all the time then? This has to do with the fact that other plugins initialize themselves on page load and may need the full markup (including the cloned element) at that point. In Dynamic Mode, there is no clone available yet on page load, so that could cause an issue if that other plugin is looking for an element that doesn\'t exist yet.','sticky-menu-or-anything-on-scroll'); ?></p>
|
47 |
+
<p><?php _e('(This may all sound terribly confusing. And it is! So, much work was done to fix this nonsense: since v2.0 of the plugin, a whole different method is being used to make elements sticky, and Dynamic Mode is not even an issue anymore.)','sticky-menu-or-anything-on-scroll'); ?></p>
|
48 |
+
<p><?php _e('Phew!','sticky-menu-or-anything-on-scroll'); ?></p>
|
|
|
|
assets/index.php
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?php // Silence is Golden
|
assets/plugin-info.php
DELETED
@@ -1,23 +0,0 @@
|
|
1 |
-
<h3>Plugin info</h3>
|
2 |
-
|
3 |
-
<?php
|
4 |
-
$options = get_option('sticky_anything_options');
|
5 |
-
$version = $options['sa_version'];
|
6 |
-
?>
|
7 |
-
|
8 |
-
<div class="inner">
|
9 |
-
|
10 |
-
<ul>
|
11 |
-
<li><strong><?php _e('Author:','Sticky Anything plugin'); ?></strong> <a href="http://www.senff.com" target="_blank">Mark Senff</a></li>
|
12 |
-
<li><strong><?php _e('Version:','Sticky Anything plugin'); ?></strong> <?php echo $version; ?></li>
|
13 |
-
<!-- <li><strong><?php _e('Detailed Documentation:','Sticky Anything plugin'); ?></strong> <a href="http://www.senff.com/plugins/sticky-anything-wp" target="_blank">Senff.com</a></li> -->
|
14 |
-
<li><strong><?php _e('Support Forum','Sticky Anything plugin'); ?></strong>: <a href="https://wordpress.org/support/plugin/sticky-menu-or-anything-on-scroll" target="_blank">WordPress.org</a></li>
|
15 |
-
<li><strong><?php _e('Development:','Sticky Anything plugin'); ?></strong> <a href="https://bitbucket.org/senff/sticky-menu-or-anything-wp" target="_blank">BitBucket</a></li>
|
16 |
-
<li><strong><?php _e('Non-WP version:','Sticky Anything plugin'); ?></strong> <a href="https://github.com/senff/Sticky-Anything" target="_blank">GitHub</a></li>
|
17 |
-
<li><strong><?php _e('Twitter:','Sticky Anything plugin'); ?></strong> <a href="http://www.twitter.com/senff" target="_blank">@Senff</a><br> </li>
|
18 |
-
<li><strong><?php _e('Donate:','Sticky Anything plugin'); ?></strong> <a href="http://www.senff.com/donate" target="_blank">Paypal</a></li>
|
19 |
-
</ul>
|
20 |
-
|
21 |
-
</div>
|
22 |
-
|
23 |
-
<p><a href="https://wordpress.org/support/plugin/sticky-menu-or-anything-on-scroll" target="_blank"><strong><?php _e('Please Report Bugs','Sticky Anything plugin'); ?></strong></a></p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/screenshot-1.png
DELETED
Binary file
|
assets/screenshot-2.png
DELETED
Binary file
|
assets/screenshots/screenshot-1.png
DELETED
Binary file
|
assets/screenshots/screenshot-2.png
DELETED
Binary file
|
assets/sidebar.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<h3>Help us keep Sticky Menu updated & free!</h3>
|
2 |
+
|
3 |
+
<?php
|
4 |
+
$options = get_option('sticky_anything_options');
|
5 |
+
$dismiss_url = add_query_arg(array('action' => 'sticky_hide_review_notification', 'redirect' => urlencode($_SERVER['REQUEST_URI'])), admin_url('admin.php'));
|
6 |
+
$dismiss_url = wp_nonce_url($dismiss_url, 'sticky_hide_review_notification');
|
7 |
+
?>
|
8 |
+
|
9 |
+
<div class="inner">
|
10 |
+
|
11 |
+
Glad to see Sticky is helping you make things stick 😎<br>Please help other users learn about Sticky by rating it. It takes only a few clicks but it keeps the plugin free, updated and supported! <b>Thank you!</b>
|
12 |
+
|
13 |
+
</div>
|
14 |
+
|
15 |
+
<p><a href="https://wordpress.org/support/plugin/sticky-menu-or-anything-on-scroll/reviews/#new-post" class="button button-primary" target="_blank">I want to rate & keep Sticky Menu free!</a> <a href="<?php echo $dismiss_url; ?>">I already rated it</a></p>
|
readme.txt
CHANGED
@@ -1,21 +1,18 @@
|
|
1 |
=== Sticky Menu (or Anything!) on Scroll ===
|
2 |
-
Contributors:
|
3 |
-
Donate link: http://www.senff.com/donate
|
4 |
Tags: sticky header, sticky menu, sticky, header, menu
|
5 |
-
Plugin URI:
|
6 |
Requires at least: 3.6
|
7 |
-
Tested up to: 4
|
8 |
-
Stable tag: 2.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
12 |
-
Sticky Menu (Or Anything
|
13 |
|
14 |
== Description ==
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
The Sticky Menu (Or Anything) On Scroll plugin for WordPress allows you to make any element on your pages "sticky" as soon as it hits the top of the page when you scroll down. Although this is commonly used to keep menus at the top of your page, the plugin allows you to make ANY element sticky (such as a Call To Action box, a logo, etc.)
|
19 |
|
20 |
A little bit of basic HTML/CSS knowledge is required. You just need to know how to pick the right selector for the element you want to make sticky, and you need to be sure it's a unique selector. Sometimes a simple selector like "nav", "#main-menu", ".menu-main-menu-1" is enough. Other times you will have to be more detailed and use a more specific selector such as "header > ul:first-child" or "nav.top .menu-header ul.main".
|
21 |
|
@@ -23,7 +20,7 @@ A little bit of basic HTML/CSS knowledge is required. You just need to know how
|
|
23 |
|
24 |
* **Any element can stick**: although common use is for navigation menus, the plugin will let you pick any unique element with a name, class or ID to stick at the top of the page once you scroll past it. Use it for a sidebar, Call-to-action box, banner ad, etc.
|
25 |
* **Positioning from top**: optionally, you can add any amount of space between the sticky element and the top of the page, so that the element is not always stuck at the "ceiling" of the page.
|
26 |
-
* **Enable for certain screen sizes only**: optionally, you can set a minimum and/or maximum screen size where the stickiness should work. This can be handy if you have a responsive site and you don't want your element to be sticky on smaller screens, for example.
|
27 |
* **Push-up element**: optionally, you can pick any other element lower on the page that will push the sticky element up again (for example a sidebar widget).
|
28 |
* **Admin Bar aware**: checks if the current user has an Admin Toolbar at the top of the page. If it has, the sticky element will not obscure it (or be obscured by it).
|
29 |
* **Z-index**: in case there are other elements on the page that obscure or peek through your sticky element, you can add a Z-index easily.
|
@@ -44,7 +41,7 @@ A little bit of basic HTML/CSS knowledge is required. You just need to know how
|
|
44 |
== Frequently Asked Questions ==
|
45 |
|
46 |
= I selected a class/ID in the settings screen, but the element doesn't stick when I scroll down. Why not? =
|
47 |
-
First, make sure that if you select the element by its
|
48 |
|
49 |
= Once the element becomes sticky, it's not positioned/sized properly at all. =
|
50 |
Due to the nature of CSS, there are situations where an element will not stick properly, usually if it has specific properties that are used to manipulate its location and/or dimensions. If your sticky element has any of the following properties, this could cause conflicts:
|
@@ -59,11 +56,11 @@ Try to avoid all this where possible, but if you can't, using the plugin in Lega
|
|
59 |
Another situation that can cause trouble, is when any parent of your sticky element has the "transform" CSS property applied to it.
|
60 |
|
61 |
= Once the element becomes sticky, it's not responsive and doesn't resize when I change the browser size.
|
62 |
-
This is a known (and annoying) bug in the plugin that I haven't been able to solve properly yet. For some sites (when the element does not contain any
|
63 |
|
64 |
= Is it possible to add some styles to the element but only when it's sticky?
|
65 |
-
To add styles to your sticky element when it's not sticky, use
|
66 |
-
To add styles to your sticky element only when it's sticky, use
|
67 |
|
68 |
The following code would give your element a red background only when it's not sticky, and blue only when it is:
|
69 |
|
@@ -102,7 +99,7 @@ NOTE: new installs of the plugin will have the Legacy Mode turned off by default
|
|
102 |
= What is this Dynamic Mode thing exactly? =
|
103 |
This mode is only available in Legacy Mode, and to properly explain this, we'll need to go a little deeper in the plugin's functionality. So bear with me...
|
104 |
|
105 |
-
In Legacy Mode, when an element becomes sticky at the top of the page (and keeps its place regardless of the scrolling), it's actually not the element itself you see, but a cloned copy of it, while the
|
106 |
|
107 |
The original element always stays where it originally is on the page, while the cloned element is always at the top of the browser viewport screen. However, you will never see them both at the same time; depending on your scroll position, it always just shows either one or the other.
|
108 |
|
@@ -121,18 +118,21 @@ Phew!
|
|
121 |
= I'll need more help please! =
|
122 |
Please go to the plugin's [support forum on WordPress.org](https://wordpress.org/support/plugin/sticky-menu-or-anything-on-scroll) and post a message (include a link to your site if possible). Repsonse time is usually within a few hours maximum.
|
123 |
|
124 |
-
= I need some functionality that the plugin currently doesn't support. Can you help make a custom version? =
|
125 |
-
If the customization is fairly minor, I can probably help out right away. However, if the requested customization is of a more complex nature, I won't be able to do it quickly/free and it may take a number of hours. If you're interested in that, please go to the plugin's [support forum on WordPress.org](https://wordpress.org/support/plugin/sticky-menu-or-anything-on-scroll) and let me know that you'll need some custom work (include a link to your site if possible).
|
126 |
-
|
127 |
|
128 |
== Screenshots ==
|
129 |
|
130 |
-
1. Basic Settings screen
|
131 |
-
2. Advanced Settings screen
|
132 |
|
133 |
|
134 |
== Changelog ==
|
135 |
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
= 2.1.1 =
|
137 |
* Fixed minification bug
|
138 |
|
@@ -201,7 +201,7 @@ If the customization is fairly minor, I can probably help out right away. Howeve
|
|
201 |
* Bug fixes
|
202 |
|
203 |
= 2.1 =
|
204 |
-
* Functionality for targeting sticky/non-sticky
|
205 |
|
206 |
= 2.0.1 =
|
207 |
* A few small bug fixes
|
@@ -243,4 +243,4 @@ If the customization is fairly minor, I can probably help out right away. Howeve
|
|
243 |
* Added functionality (minimum and/or maximum screen size)
|
244 |
|
245 |
= 1.0 =
|
246 |
-
* Initial release of the plugin
|
1 |
=== Sticky Menu (or Anything!) on Scroll ===
|
2 |
+
Contributors: webfactory, wpreset, underconstructionpage, googlemapswidget
|
|
|
3 |
Tags: sticky header, sticky menu, sticky, header, menu
|
4 |
+
Plugin URI: https://wordpress.org/plugins/sticky-menu-or-anything-on-scroll/
|
5 |
Requires at least: 3.6
|
6 |
+
Tested up to: 5.4
|
7 |
+
Stable tag: 2.2
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
+
Sticky Menu (Or Anything) On Scroll lets you choose any element that will be "sticky" at the top once you scroll down.
|
12 |
|
13 |
== Description ==
|
14 |
|
15 |
+
The Sticky Menu (Or Anything) On Scroll plugin for WordPress allows you to **make any element on your pages "sticky"** as soon as it hits the top of the page when you scroll down. Although this is commonly used to keep menus at the top of your page, the plugin allows you to make ANY element sticky (such as a Call To Action box, a logo, etc.)
|
|
|
|
|
16 |
|
17 |
A little bit of basic HTML/CSS knowledge is required. You just need to know how to pick the right selector for the element you want to make sticky, and you need to be sure it's a unique selector. Sometimes a simple selector like "nav", "#main-menu", ".menu-main-menu-1" is enough. Other times you will have to be more detailed and use a more specific selector such as "header > ul:first-child" or "nav.top .menu-header ul.main".
|
18 |
|
20 |
|
21 |
* **Any element can stick**: although common use is for navigation menus, the plugin will let you pick any unique element with a name, class or ID to stick at the top of the page once you scroll past it. Use it for a sidebar, Call-to-action box, banner ad, etc.
|
22 |
* **Positioning from top**: optionally, you can add any amount of space between the sticky element and the top of the page, so that the element is not always stuck at the "ceiling" of the page.
|
23 |
+
* **Enable for certain screen sizes only**: optionally, you can set a minimum and/or maximum screen size where the stickiness should work. This can be handy if you have a responsive site and you don't want your element to be sticky on smaller screens, for example.
|
24 |
* **Push-up element**: optionally, you can pick any other element lower on the page that will push the sticky element up again (for example a sidebar widget).
|
25 |
* **Admin Bar aware**: checks if the current user has an Admin Toolbar at the top of the page. If it has, the sticky element will not obscure it (or be obscured by it).
|
26 |
* **Z-index**: in case there are other elements on the page that obscure or peek through your sticky element, you can add a Z-index easily.
|
41 |
== Frequently Asked Questions ==
|
42 |
|
43 |
= I selected a class/ID in the settings screen, but the element doesn't stick when I scroll down. Why not? =
|
44 |
+
First, make sure that if you select the element by its class name, it is preceded by a dot (e.g. ".main-menu"), and if you select it by its ID, that it's preceded by a pound/hash/number sign (e.g. "#main-menu"). Also, make sure there is only ONE element on the page with the selector you're using. If there is none, or more than one element that matches your selector, nothing will happen.
|
45 |
|
46 |
= Once the element becomes sticky, it's not positioned/sized properly at all. =
|
47 |
Due to the nature of CSS, there are situations where an element will not stick properly, usually if it has specific properties that are used to manipulate its location and/or dimensions. If your sticky element has any of the following properties, this could cause conflicts:
|
56 |
Another situation that can cause trouble, is when any parent of your sticky element has the "transform" CSS property applied to it.
|
57 |
|
58 |
= Once the element becomes sticky, it's not responsive and doesn't resize when I change the browser size.
|
59 |
+
This is a known (and annoying) bug in the plugin that I haven't been able to solve properly yet. For some sites (when the element does not contain any JavaScript interactivity, usually), it sometimes helps to use the plugin in Legacy Mode (see below).
|
60 |
|
61 |
= Is it possible to add some styles to the element but only when it's sticky?
|
62 |
+
To add styles to your sticky element when it's not sticky, use class name ".element-is-not-sticky".
|
63 |
+
To add styles to your sticky element only when it's sticky, use class name ".element-is-sticky"
|
64 |
|
65 |
The following code would give your element a red background only when it's not sticky, and blue only when it is:
|
66 |
|
99 |
= What is this Dynamic Mode thing exactly? =
|
100 |
This mode is only available in Legacy Mode, and to properly explain this, we'll need to go a little deeper in the plugin's functionality. So bear with me...
|
101 |
|
102 |
+
In Legacy Mode, when an element becomes sticky at the top of the page (and keeps its place regardless of the scrolling), it's actually not the element itself you see, but a cloned copy of it, while the actual original element is out of view and invisible.
|
103 |
|
104 |
The original element always stays where it originally is on the page, while the cloned element is always at the top of the browser viewport screen. However, you will never see them both at the same time; depending on your scroll position, it always just shows either one or the other.
|
105 |
|
118 |
= I'll need more help please! =
|
119 |
Please go to the plugin's [support forum on WordPress.org](https://wordpress.org/support/plugin/sticky-menu-or-anything-on-scroll) and post a message (include a link to your site if possible). Repsonse time is usually within a few hours maximum.
|
120 |
|
|
|
|
|
|
|
121 |
|
122 |
== Screenshots ==
|
123 |
|
124 |
+
1. Basic Sticky Menu Settings screen
|
125 |
+
2. Advanced Sticky Menu Settings screen
|
126 |
|
127 |
|
128 |
== Changelog ==
|
129 |
|
130 |
+
= 2.2 =
|
131 |
+
* 2020-02-01
|
132 |
+
* bug fixes
|
133 |
+
* minor GUI improvements
|
134 |
+
* 100,000 users hit on 2020-01-31
|
135 |
+
|
136 |
= 2.1.1 =
|
137 |
* Fixed minification bug
|
138 |
|
201 |
* Bug fixes
|
202 |
|
203 |
= 2.1 =
|
204 |
+
* Functionality for targeting sticky/non-sticky class names added
|
205 |
|
206 |
= 2.0.1 =
|
207 |
* A few small bug fixes
|
243 |
* Added functionality (minimum and/or maximum screen size)
|
244 |
|
245 |
= 1.0 =
|
246 |
+
* Initial release of the plugin
|
sticky-menu-or-anything.php
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Sticky Menu (or Anything!) on Scroll
|
4 |
-
Plugin URI:
|
5 |
-
Description: Pick any element on
|
6 |
-
Author:
|
7 |
-
Author URI:
|
8 |
-
Version: 2.
|
9 |
*/
|
10 |
|
11 |
defined('ABSPATH') or die('INSERT COIN');
|
@@ -27,15 +27,16 @@ if (!function_exists('sticky_anthing_default_options')) {
|
|
27 |
$new_options['sa_element'] = '';
|
28 |
$new_options['sa_topspace'] = '';
|
29 |
$new_options['sa_adminbar'] = true;
|
30 |
-
$new_options['sa_minscreenwidth'] = '';
|
31 |
-
$new_options['sa_maxscreenwidth'] = '';
|
32 |
$new_options['sa_zindex'] = '';
|
33 |
$new_options['sa_legacymode'] = false;
|
34 |
-
$new_options['sa_dynamicmode'] = false;
|
35 |
$new_options['sa_debugmode'] = false;
|
36 |
$new_options['sa_pushup'] = '';
|
|
|
37 |
add_option('sticky_anything_options',$new_options);
|
38 |
-
}
|
39 |
}
|
40 |
}
|
41 |
|
@@ -53,24 +54,24 @@ if (!function_exists('sticky_anything_update')) {
|
|
53 |
// Introduced in version 1.1
|
54 |
$existing_options['sa_minscreenwidth'] = '';
|
55 |
$existing_options['sa_maxscreenwidth'] = '';
|
56 |
-
}
|
57 |
|
58 |
if(!isset($existing_options['sa_dynamicmode'])) {
|
59 |
// Introduced in version 1.2
|
60 |
$existing_options['sa_dynamicmode'] = false;
|
61 |
-
}
|
62 |
|
63 |
if(!isset($existing_options['sa_pushup'])) {
|
64 |
// Introduced in version 1.3
|
65 |
$existing_options['sa_pushup'] = '';
|
66 |
$existing_options['sa_adminbar'] = true;
|
67 |
-
}
|
68 |
|
69 |
if(!isset($existing_options['sa_legacymode'])) {
|
70 |
// Introduced in version 2.0
|
71 |
// Keep the old/legacy mode, since that mode obviously worked before the upgrade.
|
72 |
$existing_options['sa_legacymode'] = true;
|
73 |
-
|
74 |
|
75 |
$existing_options['sa_version'] = $versionNum;
|
76 |
update_option('sticky_anything_options',$existing_options);
|
@@ -87,7 +88,7 @@ if (!function_exists('load_sticky_anything')) {
|
|
87 |
$options = get_option('sticky_anything_options');
|
88 |
$versionNum = $options['sa_version'];
|
89 |
|
90 |
-
// Main jQuery plugin file
|
91 |
if($options['sa_debugmode']==true){
|
92 |
wp_register_script('stickyAnythingLib', plugins_url('/assets/js/jq-sticky-anything.js', __FILE__), array( 'jquery' ), $versionNum);
|
93 |
} else {
|
@@ -95,7 +96,7 @@ if (!function_exists('load_sticky_anything')) {
|
|
95 |
}
|
96 |
wp_enqueue_script('stickyAnythingLib');
|
97 |
|
98 |
-
// Set defaults for by-default-empty elements (because '' does not work with the JQ plugin)
|
99 |
if (!$options['sa_topspace']) {
|
100 |
$options['sa_topspace'] = '0';
|
101 |
}
|
@@ -147,10 +148,10 @@ if (!function_exists('sticky_anything_menu')) {
|
|
147 |
* --- ADD LINK TO SETTINGS PAGE TO PLUGIN ------------------------------------------------------------
|
148 |
*/
|
149 |
if (!function_exists('sticky_anything_settings_link')) {
|
150 |
-
function sticky_anything_settings_link($links) {
|
151 |
-
$settings_link = '<a href="options-general.php?page=stickyanythingmenu">Settings</a>';
|
152 |
-
array_unshift($links, $settings_link);
|
153 |
-
return $links;
|
154 |
}
|
155 |
}
|
156 |
|
@@ -165,45 +166,56 @@ if (!function_exists('sticky_anything_config_page')) {
|
|
165 |
?>
|
166 |
|
167 |
<div id="sticky-anything-settings-general" class="wrap">
|
168 |
-
<h2><?php _e('Sticky Menu (or Anything!) Settings','
|
169 |
-
|
170 |
-
<p><?php _e('Pick any element on your page, and it will stick when it reaches the top of the page when you scroll down. Usually handy for navigation menus, but can be used for any (unique) element on your page.','Sticky Anything plugin'); ?></p>
|
171 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
<div class="main-content">
|
173 |
|
174 |
-
<?php
|
175 |
-
if ( isset( $_GET['tab'] )) {
|
176 |
$activeTab = $_GET['tab'];
|
177 |
} else {
|
178 |
$activeTab = 'main';
|
179 |
}
|
180 |
?>
|
181 |
|
182 |
-
<h2 class="nav-tab-wrapper">
|
183 |
-
<a class="nav-tab <?php if ($activeTab == 'main') { echo 'nav-tab-active'; } ?>" href="#main"><?php _e('Basic settings','
|
184 |
-
<a class="nav-tab <?php if ($activeTab == 'advanced') { echo 'nav-tab-active'; } ?>" href="#advanced"><?php _e('Advanced settings','
|
185 |
-
<a class="nav-tab <?php if ($activeTab == 'faq') { echo ' nav-tab-active'; } ?>" href="#faq"><?php _e('FAQ/Troubleshooting','
|
186 |
</h2>
|
187 |
|
188 |
<br>
|
189 |
|
190 |
-
<?php
|
191 |
|
192 |
$warnings = false;
|
193 |
|
194 |
-
if ( isset( $_GET['message'] )) {
|
195 |
if ($_GET['message'] == '1') {
|
196 |
-
echo '<div id="message" class="fade updated"><p><strong>'.__('Settings Updated.','
|
197 |
}
|
198 |
-
}
|
199 |
-
|
200 |
-
if ( isset( $_GET['message'] )) {
|
201 |
if ($sticky_anything_options['sa_element'] == '') {
|
202 |
-
$warnings = true;
|
203 |
}
|
204 |
}
|
205 |
|
206 |
-
if ( (!is_numeric(
|
207 |
// Top space is not empty and has bad value
|
208 |
$warnings = true;
|
209 |
}
|
@@ -223,45 +235,45 @@ if (!function_exists('sticky_anything_config_page')) {
|
|
223 |
$warnings = true;
|
224 |
}
|
225 |
|
226 |
-
if ((!is_numeric(
|
227 |
// Z-index is not empty and has bad value
|
228 |
$warnings = true;
|
229 |
}
|
230 |
|
231 |
// IF THERE ARE ERRORS, SHOW THEM
|
232 |
-
if ( $warnings == true ) {
|
233 |
-
echo '<div id="message" class="error"><p><strong>'.__('Please review the current settings:','
|
234 |
echo '<ul style="list-style-type:disc; margin:0 0 20px 24px;">';
|
235 |
|
236 |
if ($sticky_anything_options['sa_element'] == '') {
|
237 |
-
echo '<li>'.__('
|
238 |
-
}
|
239 |
|
240 |
if ( (!is_numeric($sticky_anything_options['sa_topspace'])) && ($sticky_anything_options['sa_topspace'] != '')) {
|
241 |
-
echo '<li>'.__('
|
242 |
}
|
243 |
|
244 |
if ( (!is_numeric($sticky_anything_options['sa_minscreenwidth'])) && ($sticky_anything_options['sa_minscreenwidth'] != '')) {
|
245 |
-
echo '<li>'.__('
|
246 |
}
|
247 |
|
248 |
if ( (!is_numeric($sticky_anything_options['sa_maxscreenwidth'])) && ($sticky_anything_options['sa_maxscreenwidth'] != '')) {
|
249 |
-
echo '<li>'.__('
|
250 |
}
|
251 |
|
252 |
if ( ($sticky_anything_options['sa_minscreenwidth'] != '') && ($sticky_anything_options['sa_maxscreenwidth'] != '') && ( ($sticky_anything_options['sa_minscreenwidth']) >= ($sticky_anything_options['sa_maxscreenwidth']) ) ) {
|
253 |
-
echo '<li>'.__('MAXIMUM screen width has to have a larger value than the MINIMUM screen width.','
|
254 |
}
|
255 |
|
256 |
if ((!is_numeric($sticky_anything_options['sa_zindex'])) && ($sticky_anything_options['sa_zindex'] != '')) {
|
257 |
-
echo '<li>'.__('Z-
|
258 |
}
|
259 |
|
260 |
echo '</ul></div>';
|
261 |
-
}
|
262 |
|
263 |
?>
|
264 |
-
|
265 |
<div class="tabs-content">
|
266 |
|
267 |
<form method="post" action="admin-post.php">
|
@@ -275,41 +287,41 @@ if (!function_exists('sticky_anything_config_page')) {
|
|
275 |
<table class="form-table">
|
276 |
|
277 |
<tr>
|
278 |
-
<th scope="row"><?php _e('Sticky Element:','
|
279 |
<td>
|
280 |
-
<input type="text" id="sa_element" name="sa_element" value="<?php
|
281 |
-
if (
|
282 |
-
echo esc_html(
|
283 |
}
|
284 |
-
?>"/> <em><?php _e('(choose ONE element, e.g. <strong>#main-navigation</strong>, OR <strong>.main-menu-1</strong>, OR <strong>header nav</strong>, etc.)','
|
285 |
</td>
|
286 |
</tr>
|
287 |
|
288 |
|
289 |
<tr>
|
290 |
-
<th scope="row"><?php _e('Space between top of page and sticky element: (optional)','
|
291 |
<td>
|
292 |
-
<input type="number" id="sa_topspace" name="sa_topspace" value="<?php echo esc_html(
|
293 |
</td>
|
294 |
</tr>
|
295 |
|
296 |
<tr>
|
297 |
-
<th scope="row"><?php _e('Check for Admin Toolbar:','
|
298 |
<td>
|
299 |
<input type="checkbox" id="sa_adminbar" name="sa_adminbar" <?php if ($sticky_anything_options['sa_adminbar'] ) echo ' checked="checked" ';?> />
|
300 |
-
<label for="sa_adminbar"><strong><?php _e('Move the sticky element down a little if there is an Administrator Toolbar at the top (for logged in users).','
|
301 |
</td>
|
302 |
</tr>
|
303 |
|
304 |
<tr>
|
305 |
-
<th scope="row"><?php _e('Do not stick element when screen smaller than: (optional)','
|
306 |
<td>
|
307 |
<input type="number" id="sa_minscreenwidth" name="sa_minscreenwidth" value="<?php echo esc_html( $sticky_anything_options['sa_minscreenwidth'] ); ?>" style="width:80px;" /> pixels
|
308 |
</td>
|
309 |
</tr>
|
310 |
|
311 |
<tr>
|
312 |
-
<th scope="row"><?php _e('Do not stick element when screen larger than: (optional)','
|
313 |
<td>
|
314 |
<input type="number" id="sa_maxscreenwidth" name="sa_maxscreenwidth" value="<?php echo esc_html( $sticky_anything_options['sa_maxscreenwidth'] ); ?>" style="width:80px;" /> pixels
|
315 |
</td>
|
@@ -328,48 +340,48 @@ if (!function_exists('sticky_anything_config_page')) {
|
|
328 |
<table class="form-table">
|
329 |
|
330 |
<tr>
|
331 |
-
<th scope="row"><?php _e('Z-index: (optional)','
|
332 |
<td>
|
333 |
-
<input type="number" id="sa_zindex" name="sa_zindex" value="<?php echo esc_html(
|
334 |
</td>
|
335 |
</tr>
|
336 |
|
337 |
<tr>
|
338 |
-
<th scope="row"><?php _e('Push-up element (optional):','
|
339 |
<td>
|
340 |
-
<input type="text" id="sa_pushup" name="sa_pushup" value="<?php
|
341 |
if ($sticky_anything_options['sa_pushup'] != '#NO-ELEMENT') {
|
342 |
-
echo esc_html( $sticky_anything_options['sa_pushup'] );
|
343 |
}
|
344 |
-
?>"/> <em><?php _e('(choose ONE element, e.g. <strong>#footer</strong>, OR <strong>.widget-bottom</strong>, etc.)','
|
345 |
</td>
|
346 |
</tr>
|
347 |
|
348 |
<tr>
|
349 |
-
<th scope="row"><!-- <span class="new"><?php _e('NEW!','
|
350 |
<td>
|
351 |
<input type="checkbox" id="sa_legacymode" name="sa_legacymode" <?php if ($sticky_anything_options['sa_legacymode'] == true ) echo ' checked="checked" ';?> />
|
352 |
-
<label for="sa_legacymode"><strong><?php _e('Legacy Mode (only recommended if you upgraded from earlier version).','
|
353 |
-
<p class="description"><?php _e('In version 2.0, a new/better method for making elements sticky was introduced. However, if you upgraded this plugin from an earlier version, and the old method always worked for you, there is no need to use the new method and you should keep this option checked.<br>More information about this setting can be found in the <a href="#faq" class="faq">FAQ</a>.','
|
354 |
</td>
|
355 |
</tr>
|
356 |
|
357 |
<tr id="row-dynamic-mode" <?php if ($sticky_anything_options['sa_legacymode'] == false ) echo 'class="disabled-feature"';?>>
|
358 |
-
<th scope="row"><div class="showhide" <?php if ($sticky_anything_options['sa_legacymode'] == false ) echo 'style="display:none;"';?>><?php _e('Dynamic mode:','
|
359 |
<td><div class="showhide" <?php if ($sticky_anything_options['sa_legacymode'] == false ) echo 'style="display:none;"';?>>
|
360 |
<input type="checkbox" id="sa_dynamicmode" name="sa_dynamicmode" <?php if ($sticky_anything_options['sa_dynamicmode'] ) echo ' checked="checked" ';?> />
|
361 |
-
<label for="sa_dynamicmode"><strong><?php _e('If the plugin doesn\'t work in your theme (often the case with responsive themes), try it in Dynamic Mode.','
|
362 |
-
<p class="description"><?php _e('NOTE: this is not a \'Magic Checkbox\' that fixes all problems. It simply solves some issues that frequently appear with some responsive themes, but doesn\'t necessarily work in ALL situations.','
|
363 |
</div>
|
364 |
</td>
|
365 |
</tr>
|
366 |
|
367 |
<tr>
|
368 |
-
<th scope="row"><?php _e('Debug mode:','
|
369 |
<td>
|
370 |
-
<input type="checkbox" id="sa_debugmode" name="sa_debugmode" <?php if (
|
371 |
-
<label for="sa_debugmode"><strong><?php _e('Log plugin errors in browser console','
|
372 |
-
<p class="description"><?php _e('This will help debugging the plugin in case of problems. Do NOT check this option in production environments.','
|
373 |
</td>
|
374 |
</tr>
|
375 |
|
@@ -380,8 +392,8 @@ if (!function_exists('sticky_anything_config_page')) {
|
|
380 |
<div class="tab-content tab-sticky-main tab-sticky-advanced <?php if (($activeTab != 'main') && ($activeTab != 'advanced')) {echo 'hide';} ?>">
|
381 |
|
382 |
<input type="hidden" name="sa_tab" value="<?php echo $activeTab ?>">
|
383 |
-
|
384 |
-
<br><input type="submit" value="<?php _e('
|
385 |
|
386 |
</div>
|
387 |
|
@@ -395,9 +407,14 @@ if (!function_exists('sticky_anything_config_page')) {
|
|
395 |
|
396 |
</div>
|
397 |
|
398 |
-
|
399 |
-
|
400 |
-
|
|
|
|
|
|
|
|
|
|
|
401 |
|
402 |
</div>
|
403 |
|
@@ -427,7 +444,7 @@ if (!function_exists('process_sticky_anything_options')) {
|
|
427 |
foreach ( array('sa_element') as $option_name ) {
|
428 |
if ( isset( $_POST[$option_name] ) ) {
|
429 |
$options[$option_name] = sanitize_text_field( $_POST[$option_name] );
|
430 |
-
}
|
431 |
}
|
432 |
|
433 |
foreach ( array('sa_topspace') as $option_name ) {
|
@@ -457,7 +474,7 @@ if (!function_exists('process_sticky_anything_options')) {
|
|
457 |
foreach ( array('sa_pushup') as $option_name ) {
|
458 |
if ( isset( $_POST[$option_name] ) ) {
|
459 |
$options[$option_name] = sanitize_text_field( $_POST[$option_name] );
|
460 |
-
}
|
461 |
}
|
462 |
|
463 |
foreach ( array('sa_adminbar') as $option_name ) {
|
@@ -495,17 +512,17 @@ if (!function_exists('process_sticky_anything_options')) {
|
|
495 |
foreach ( array('sa_tab') as $option_name ) {
|
496 |
if ( isset( $_POST[$option_name] ) ) {
|
497 |
$options[$option_name] = sanitize_text_field( $_POST[$option_name] );
|
498 |
-
}
|
499 |
}
|
500 |
|
501 |
$tabValue = $_POST['sa_tab'];
|
502 |
|
503 |
-
update_option( 'sticky_anything_options', $options );
|
504 |
wp_redirect( add_query_arg(
|
505 |
array('page' => 'stickyanythingmenu', 'message' => '1', 'tab' => $tabValue),
|
506 |
-
admin_url( 'options-general.php' )
|
507 |
)
|
508 |
-
);
|
509 |
|
510 |
exit;
|
511 |
}
|
@@ -525,16 +542,108 @@ if (!function_exists('sticky_anything_styles')) {
|
|
525 |
wp_enqueue_script('stickyAnythingAdminScript');
|
526 |
|
527 |
wp_register_style('stickyAnythingAdminStyle', plugins_url('/assets/css/sticky-anything-admin.css', __FILE__) );
|
528 |
-
wp_enqueue_style('stickyAnythingAdminStyle');
|
529 |
}
|
530 |
}
|
531 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
532 |
|
533 |
/**
|
534 |
* === HOOKS AND ACTIONS AND FILTERS AND SUCH ==========================================================
|
535 |
*/
|
536 |
|
537 |
-
$plugin = plugin_basename(__FILE__);
|
538 |
|
539 |
register_activation_hook( __FILE__, 'sticky_anthing_default_options' );
|
540 |
add_action('init','sticky_anything_update',1);
|
@@ -543,3 +652,5 @@ add_action('admin_menu', 'sticky_anything_menu');
|
|
543 |
add_action('admin_init', 'sticky_anything_admin_init' );
|
544 |
add_action('admin_enqueue_scripts', 'sticky_anything_styles' );
|
545 |
add_filter("plugin_action_links_$plugin", 'sticky_anything_settings_link' );
|
|
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Sticky Menu (or Anything!) on Scroll
|
4 |
+
Plugin URI: https://wordpress.org/plugins/sticky-menu-or-anything-on-scroll/
|
5 |
+
Description: Pick any element on the page, and it will stick when it reaches the top of the page when you scroll down. Handy for navigation menus, but can be used for any element on the page.
|
6 |
+
Author: WebFactory Ltd
|
7 |
+
Author URI: https://www.webfactoryltd.com/
|
8 |
+
Version: 2.2
|
9 |
*/
|
10 |
|
11 |
defined('ABSPATH') or die('INSERT COIN');
|
27 |
$new_options['sa_element'] = '';
|
28 |
$new_options['sa_topspace'] = '';
|
29 |
$new_options['sa_adminbar'] = true;
|
30 |
+
$new_options['sa_minscreenwidth'] = '';
|
31 |
+
$new_options['sa_maxscreenwidth'] = '';
|
32 |
$new_options['sa_zindex'] = '';
|
33 |
$new_options['sa_legacymode'] = false;
|
34 |
+
$new_options['sa_dynamicmode'] = false;
|
35 |
$new_options['sa_debugmode'] = false;
|
36 |
$new_options['sa_pushup'] = '';
|
37 |
+
$new_options['sa_hide_review_notification'] = false;
|
38 |
add_option('sticky_anything_options',$new_options);
|
39 |
+
}
|
40 |
}
|
41 |
}
|
42 |
|
54 |
// Introduced in version 1.1
|
55 |
$existing_options['sa_minscreenwidth'] = '';
|
56 |
$existing_options['sa_maxscreenwidth'] = '';
|
57 |
+
}
|
58 |
|
59 |
if(!isset($existing_options['sa_dynamicmode'])) {
|
60 |
// Introduced in version 1.2
|
61 |
$existing_options['sa_dynamicmode'] = false;
|
62 |
+
}
|
63 |
|
64 |
if(!isset($existing_options['sa_pushup'])) {
|
65 |
// Introduced in version 1.3
|
66 |
$existing_options['sa_pushup'] = '';
|
67 |
$existing_options['sa_adminbar'] = true;
|
68 |
+
}
|
69 |
|
70 |
if(!isset($existing_options['sa_legacymode'])) {
|
71 |
// Introduced in version 2.0
|
72 |
// Keep the old/legacy mode, since that mode obviously worked before the upgrade.
|
73 |
$existing_options['sa_legacymode'] = true;
|
74 |
+
}
|
75 |
|
76 |
$existing_options['sa_version'] = $versionNum;
|
77 |
update_option('sticky_anything_options',$existing_options);
|
88 |
$options = get_option('sticky_anything_options');
|
89 |
$versionNum = $options['sa_version'];
|
90 |
|
91 |
+
// Main jQuery plugin file
|
92 |
if($options['sa_debugmode']==true){
|
93 |
wp_register_script('stickyAnythingLib', plugins_url('/assets/js/jq-sticky-anything.js', __FILE__), array( 'jquery' ), $versionNum);
|
94 |
} else {
|
96 |
}
|
97 |
wp_enqueue_script('stickyAnythingLib');
|
98 |
|
99 |
+
// Set defaults for by-default-empty elements (because '' does not work with the JQ plugin)
|
100 |
if (!$options['sa_topspace']) {
|
101 |
$options['sa_topspace'] = '0';
|
102 |
}
|
148 |
* --- ADD LINK TO SETTINGS PAGE TO PLUGIN ------------------------------------------------------------
|
149 |
*/
|
150 |
if (!function_exists('sticky_anything_settings_link')) {
|
151 |
+
function sticky_anything_settings_link($links) {
|
152 |
+
$settings_link = '<a href="options-general.php?page=stickyanythingmenu">Settings</a>';
|
153 |
+
array_unshift($links, $settings_link);
|
154 |
+
return $links;
|
155 |
}
|
156 |
}
|
157 |
|
166 |
?>
|
167 |
|
168 |
<div id="sticky-anything-settings-general" class="wrap">
|
169 |
+
<h2><?php _e('Sticky Menu (or Anything!) Settings','sticky-menu-or-anything-on-scroll'); ?></h2>
|
|
|
|
|
170 |
|
171 |
+
<p><?php _e('Pick any element on your page, and it will stick when it reaches the top of the page when you scroll down. Usually handy for navigation menus, but can be used for any (unique) element on your page.','sticky-menu-or-anything-on-scroll'); ?></p>
|
172 |
+
<?php
|
173 |
+
if (!empty($sticky_anything_options['sa_element']) && empty($sticky_anything_options['sa_hide_review_notification'])) {
|
174 |
+
$dismiss_url = add_query_arg(array('action' => 'sticky_hide_review_notification', 'redirect' => urlencode($_SERVER['REQUEST_URI'])), admin_url('admin.php'));
|
175 |
+
$dismiss_url = wp_nonce_url($dismiss_url, 'sticky_hide_review_notification');
|
176 |
+
?>
|
177 |
+
<div class="notice-info notice notice-rate"><p><strong>Help us keep Sticky Menu updated & free!</strong></p>
|
178 |
+
<p>Glad to see Sticky is helping you make things stick 😎<br>Please help other users learn about Sticky by rating it. It takes only a few clicks but it keeps the plugin free, updated and supported! <b>Thank you!</b></p>
|
179 |
+
<p><a href="https://wordpress.org/support/plugin/sticky-menu-or-anything-on-scroll/reviews/#new-post" class="button button-primary" target="_blank">I want to rate & keep Sticky Menu free!</a> <a href="<?php echo $dismiss_url; ?>">I already rated it</a></p>
|
180 |
+
</div>
|
181 |
+
<?php
|
182 |
+
}
|
183 |
+
?>
|
184 |
<div class="main-content">
|
185 |
|
186 |
+
<?php
|
187 |
+
if ( isset( $_GET['tab'] )) {
|
188 |
$activeTab = $_GET['tab'];
|
189 |
} else {
|
190 |
$activeTab = 'main';
|
191 |
}
|
192 |
?>
|
193 |
|
194 |
+
<h2 class="nav-tab-wrapper">
|
195 |
+
<a class="nav-tab <?php if ($activeTab == 'main') { echo 'nav-tab-active'; } ?>" href="#main"><?php _e('Basic settings','sticky-menu-or-anything-on-scroll'); ?></a>
|
196 |
+
<a class="nav-tab <?php if ($activeTab == 'advanced') { echo 'nav-tab-active'; } ?>" href="#advanced"><?php _e('Advanced settings','sticky-menu-or-anything-on-scroll'); ?></a>
|
197 |
+
<a class="nav-tab <?php if ($activeTab == 'faq') { echo ' nav-tab-active'; } ?>" href="#faq"><?php _e('FAQ/Troubleshooting','sticky-menu-or-anything-on-scroll'); ?></a>
|
198 |
</h2>
|
199 |
|
200 |
<br>
|
201 |
|
202 |
+
<?php
|
203 |
|
204 |
$warnings = false;
|
205 |
|
206 |
+
if ( isset( $_GET['message'] )) {
|
207 |
if ($_GET['message'] == '1') {
|
208 |
+
echo '<div id="message" class="fade updated"><p><strong>'.__('Settings Updated.','sticky-menu-or-anything-on-scroll').'</strong></p></div>';
|
209 |
}
|
210 |
+
}
|
211 |
+
|
212 |
+
if ( isset( $_GET['message'] )) {
|
213 |
if ($sticky_anything_options['sa_element'] == '') {
|
214 |
+
$warnings = true;
|
215 |
}
|
216 |
}
|
217 |
|
218 |
+
if ( (!is_numeric(@$sticky_anything_options['sa_topspace'])) && (@$sticky_anything_options['sa_topspace'] != '')) {
|
219 |
// Top space is not empty and has bad value
|
220 |
$warnings = true;
|
221 |
}
|
235 |
$warnings = true;
|
236 |
}
|
237 |
|
238 |
+
if ((!is_numeric(@$sticky_anything_options['sa_zindex'])) && (@$sticky_anything_options['sa_zindex'] != '')) {
|
239 |
// Z-index is not empty and has bad value
|
240 |
$warnings = true;
|
241 |
}
|
242 |
|
243 |
// IF THERE ARE ERRORS, SHOW THEM
|
244 |
+
if ( $warnings == true ) {
|
245 |
+
echo '<div id="message" class="error"><p><strong>'.__('Please review the current settings:','sticky-menu-or-anything-on-scroll').'</strong></p>';
|
246 |
echo '<ul style="list-style-type:disc; margin:0 0 20px 24px;">';
|
247 |
|
248 |
if ($sticky_anything_options['sa_element'] == '') {
|
249 |
+
echo '<li>'.__('<b>Sticky Element</b> is a required field. If you do not want anything sticky, consider disabling the plugin.','sticky-menu-or-anything-on-scroll').'</li>';
|
250 |
+
}
|
251 |
|
252 |
if ( (!is_numeric($sticky_anything_options['sa_topspace'])) && ($sticky_anything_options['sa_topspace'] != '')) {
|
253 |
+
echo '<li>'.__('<b>Top Position</b> has to be a number (do not include "px" or "pixels", or any other characters).','sticky-menu-or-anything-on-scroll').'</li>';
|
254 |
}
|
255 |
|
256 |
if ( (!is_numeric($sticky_anything_options['sa_minscreenwidth'])) && ($sticky_anything_options['sa_minscreenwidth'] != '')) {
|
257 |
+
echo '<li>'.__('<b>Minimum Screen Width</b> has to be a number (do not include "px" or "pixels", or any other characters).','sticky-menu-or-anything-on-scroll').'</li>';
|
258 |
}
|
259 |
|
260 |
if ( (!is_numeric($sticky_anything_options['sa_maxscreenwidth'])) && ($sticky_anything_options['sa_maxscreenwidth'] != '')) {
|
261 |
+
echo '<li>'.__('<b>Maximum Screen Width</b> has to be a number (do not include "px" or "pixels", or any other characters).','sticky-menu-or-anything-on-scroll').'</li>';
|
262 |
}
|
263 |
|
264 |
if ( ($sticky_anything_options['sa_minscreenwidth'] != '') && ($sticky_anything_options['sa_maxscreenwidth'] != '') && ( ($sticky_anything_options['sa_minscreenwidth']) >= ($sticky_anything_options['sa_maxscreenwidth']) ) ) {
|
265 |
+
echo '<li>'.__('MAXIMUM screen width has to have a larger value than the MINIMUM screen width.','sticky-menu-or-anything-on-scroll').'</li>';
|
266 |
}
|
267 |
|
268 |
if ((!is_numeric($sticky_anything_options['sa_zindex'])) && ($sticky_anything_options['sa_zindex'] != '')) {
|
269 |
+
echo '<li>'.__('<b>Z-Index</b> has to be a number (do not include any other characters).','sticky-menu-or-anything-on-scroll').'</li>';
|
270 |
}
|
271 |
|
272 |
echo '</ul></div>';
|
273 |
+
}
|
274 |
|
275 |
?>
|
276 |
+
|
277 |
<div class="tabs-content">
|
278 |
|
279 |
<form method="post" action="admin-post.php">
|
287 |
<table class="form-table">
|
288 |
|
289 |
<tr>
|
290 |
+
<th scope="row"><label for="sa_element"><?php _e('Sticky Element:','sticky-menu-or-anything-on-scroll'); ?> (required)</label> <span tooltip="<?php _e('The element that needs to be sticky once you scroll. This can be your menu, or any other element like a sidebar, ad banner, etc. Make sure this is a unique identifier.','sticky-menu-or-anything-on-scroll'); ?>"><span class="dashicons dashicons-editor-help"></span></span></th>
|
291 |
<td>
|
292 |
+
<input type="text" id="sa_element" name="sa_element" value="<?php
|
293 |
+
if (@$sticky_anything_options['sa_element'] != '#NO-ELEMENT') {
|
294 |
+
echo esc_html( @$sticky_anything_options['sa_element'] );
|
295 |
}
|
296 |
+
?>"/> <em><?php _e('(choose ONE element, e.g. <strong>#main-navigation</strong>, OR <strong>.main-menu-1</strong>, OR <strong>header nav</strong>, etc.)','sticky-menu-or-anything-on-scroll'); ?></em>
|
297 |
</td>
|
298 |
</tr>
|
299 |
|
300 |
|
301 |
<tr>
|
302 |
+
<th scope="row"><label for="sa_topspace"><?php _e('Space between top of page and sticky element: (optional)','sticky-menu-or-anything-on-scroll'); ?></label> <span tooltip="<?php _e('If you don\'t want the element to be sticky at the very top of the page, but a little lower, add the number of pixels that should be between your element and the \'ceiling\' of the page.','sticky-menu-or-anything-on-scroll'); ?>"><span class="dashicons dashicons-editor-help"></span></a></th>
|
303 |
<td>
|
304 |
+
<input type="number" id="sa_topspace" name="sa_topspace" value="<?php echo esc_html( @$sticky_anything_options['sa_topspace'] ); ?>" style="width:80px;" /> pixels
|
305 |
</td>
|
306 |
</tr>
|
307 |
|
308 |
<tr>
|
309 |
+
<th scope="row"><?php _e('Check for Admin Toolbar:','sticky-menu-or-anything-on-scroll'); ?> <span tooltip="<?php _e('If the sticky element gets obscured by the Administrator Toolbar for logged in users (or vice versa), check this box.','sticky-menu-or-anything-on-scroll'); ?>"><span class="dashicons dashicons-editor-help"></span></a></th>
|
310 |
<td>
|
311 |
<input type="checkbox" id="sa_adminbar" name="sa_adminbar" <?php if ($sticky_anything_options['sa_adminbar'] ) echo ' checked="checked" ';?> />
|
312 |
+
<label for="sa_adminbar"><strong><?php _e('Move the sticky element down a little if there is an Administrator Toolbar at the top (for logged in users).','sticky-menu-or-anything-on-scroll'); ?></strong></label>
|
313 |
</td>
|
314 |
</tr>
|
315 |
|
316 |
<tr>
|
317 |
+
<th scope="row"><label for="sa_minscreenwidth"><?php _e('Do not stick element when screen is smaller than: (optional)','sticky-menu-or-anything-on-scroll'); ?></label> <span tooltip="<?php _e('Sometimes you do not want your element to be sticky when your screen is small (responsive menus, etc). If you enter a value here, your menu will not be sticky when your screen width is smaller than his value.','sticky-menu-or-anything-on-scroll'); ?>"><span class="dashicons dashicons-editor-help"></span></a></th>
|
318 |
<td>
|
319 |
<input type="number" id="sa_minscreenwidth" name="sa_minscreenwidth" value="<?php echo esc_html( $sticky_anything_options['sa_minscreenwidth'] ); ?>" style="width:80px;" /> pixels
|
320 |
</td>
|
321 |
</tr>
|
322 |
|
323 |
<tr>
|
324 |
+
<th scope="row"><label for="sa_maxscreenwidth"><?php _e('Do not stick element when screen is larger than: (optional)','sticky-menu-or-anything-on-scroll'); ?></label> <span tooltip="<?php _e('Sometimes you do not want your element to be sticky when your screen is large (responsive menus, etc). If you enter a value here, your menu will not be sticky when your screen width is wider than this value.','sticky-menu-or-anything-on-scroll'); ?>"><span class="dashicons dashicons-editor-help"></span></a></th>
|
325 |
<td>
|
326 |
<input type="number" id="sa_maxscreenwidth" name="sa_maxscreenwidth" value="<?php echo esc_html( $sticky_anything_options['sa_maxscreenwidth'] ); ?>" style="width:80px;" /> pixels
|
327 |
</td>
|
340 |
<table class="form-table">
|
341 |
|
342 |
<tr>
|
343 |
+
<th scope="row"><label for="sa_zindex"><?php _e('Z-index: (optional)','sticky-menu-or-anything-on-scroll'); ?></label> <span tooltip="<?php _e('If there are other elements on the page that obscure/overlap the sticky element, adding a Z-index might help. If you have no idea what that means, try entering 99999.','sticky-menu-or-anything-on-scroll'); ?>"><span class="dashicons dashicons-editor-help"></span></a></th>
|
344 |
<td>
|
345 |
+
<input type="number" id="sa_zindex" name="sa_zindex" value="<?php echo esc_html( @$sticky_anything_options['sa_zindex'] ); ?>" style="width:80px;" />
|
346 |
</td>
|
347 |
</tr>
|
348 |
|
349 |
<tr>
|
350 |
+
<th scope="row"><label for="sa_pushup"><?php _e('Push-up element (optional):','sticky-menu-or-anything-on-scroll'); ?></label> <span tooltip="<?php _e('If you want your sticky element to be \'pushed up\' again by another element lower on the page, enter it here. Make sure this is a unique identifier.','sticky-menu-or-anything-on-scroll'); ?>"><span class="dashicons dashicons-editor-help"></span></a></th>
|
351 |
<td>
|
352 |
+
<input type="text" id="sa_pushup" name="sa_pushup" value="<?php
|
353 |
if ($sticky_anything_options['sa_pushup'] != '#NO-ELEMENT') {
|
354 |
+
echo esc_html( $sticky_anything_options['sa_pushup'] );
|
355 |
}
|
356 |
+
?>"/> <em><?php _e('(choose ONE element, e.g. <strong>#footer</strong>, OR <strong>.widget-bottom</strong>, etc.)','sticky-menu-or-anything-on-scroll'); ?></em>
|
357 |
</td>
|
358 |
</tr>
|
359 |
|
360 |
<tr>
|
361 |
+
<th scope="row"><!-- <span class="new"><?php _e('NEW!','sticky-menu-or-anything-on-scroll'); ?></span>--> <?php _e('Legacy mode:','sticky-menu-or-anything-on-scroll'); ?> <span tooltip="<?php _e('If you upgraded from an earlier version and it always worked before, use legacy mode to keep using the old method.','sticky-menu-or-anything-on-scroll'); ?>"><span class="dashicons dashicons-editor-help"></span></a></th>
|
362 |
<td>
|
363 |
<input type="checkbox" id="sa_legacymode" name="sa_legacymode" <?php if ($sticky_anything_options['sa_legacymode'] == true ) echo ' checked="checked" ';?> />
|
364 |
+
<label for="sa_legacymode"><strong><?php _e('Legacy Mode (only recommended if you upgraded from earlier version).','sticky-menu-or-anything-on-scroll'); ?></strong></label>
|
365 |
+
<p class="description"><?php _e('In version 2.0, a new/better method for making elements sticky was introduced. However, if you upgraded this plugin from an earlier version, and the old method always worked for you, there is no need to use the new method and you should keep this option checked.<br>More information about this setting can be found in the <a href="#faq" class="faq">FAQ</a>.','sticky-menu-or-anything-on-scroll'); ?></p>
|
366 |
</td>
|
367 |
</tr>
|
368 |
|
369 |
<tr id="row-dynamic-mode" <?php if ($sticky_anything_options['sa_legacymode'] == false ) echo 'class="disabled-feature"';?>>
|
370 |
+
<th scope="row"><div class="showhide" <?php if ($sticky_anything_options['sa_legacymode'] == false ) echo 'style="display:none;"';?>><?php _e('Dynamic mode:','sticky-menu-or-anything-on-scroll'); ?> <span tooltip="<?php _e('When Dynamic Mode is OFF, a cloned element will be created upon page load. If this mode is ON, a cloned element will be created every time your scrolled position hits the \'sticky\' point (option available in Legacy Mode only).','sticky-menu-or-anything-on-scroll'); ?>"><span class="dashicons dashicons-editor-help"></span></a></div></th>
|
371 |
<td><div class="showhide" <?php if ($sticky_anything_options['sa_legacymode'] == false ) echo 'style="display:none;"';?>>
|
372 |
<input type="checkbox" id="sa_dynamicmode" name="sa_dynamicmode" <?php if ($sticky_anything_options['sa_dynamicmode'] ) echo ' checked="checked" ';?> />
|
373 |
+
<label for="sa_dynamicmode"><strong><?php _e('If the plugin doesn\'t work in your theme (often the case with responsive themes), try it in Dynamic Mode.','sticky-menu-or-anything-on-scroll'); ?></strong></label>
|
374 |
+
<p class="description"><?php _e('NOTE: this is not a \'Magic Checkbox\' that fixes all problems. It simply solves some issues that frequently appear with some responsive themes, but doesn\'t necessarily work in ALL situations.','sticky-menu-or-anything-on-scroll'); ?></p>
|
375 |
</div>
|
376 |
</td>
|
377 |
</tr>
|
378 |
|
379 |
<tr>
|
380 |
+
<th scope="row"><?php _e('Debug mode:','sticky-menu-or-anything-on-scroll'); ?> <span tooltip="<?php _e('When Debug Mode is on, error messages will be shown in your browser\'s console when the element you selected either doesn\'t exist, or when there are more elements on the page with your chosen selector.','sticky-menu-or-anything-on-scroll'); ?>"><span class="dashicons dashicons-editor-help"></span></a></th>
|
381 |
<td>
|
382 |
+
<input type="checkbox" id="sa_debugmode" name="sa_debugmode" <?php if (@$sticky_anything_options['sa_debugmode'] ) echo ' checked="checked" ';?> />
|
383 |
+
<label for="sa_debugmode"><strong><?php _e('Log plugin errors in browser console','sticky-menu-or-anything-on-scroll'); ?></strong></label>
|
384 |
+
<p class="description"><?php _e('This will help debugging the plugin in case of problems. Do NOT check this option in production environments.','sticky-menu-or-anything-on-scroll'); ?></p>
|
385 |
</td>
|
386 |
</tr>
|
387 |
|
392 |
<div class="tab-content tab-sticky-main tab-sticky-advanced <?php if (($activeTab != 'main') && ($activeTab != 'advanced')) {echo 'hide';} ?>">
|
393 |
|
394 |
<input type="hidden" name="sa_tab" value="<?php echo $activeTab ?>">
|
395 |
+
|
396 |
+
<br><input type="submit" value="<?php _e('Save Changes','sticky-menu-or-anything-on-scroll'); ?>" class="button-primary"/>
|
397 |
|
398 |
</div>
|
399 |
|
407 |
|
408 |
</div>
|
409 |
|
410 |
+
|
411 |
+
<?php
|
412 |
+
if (empty($sticky_anything_options['sa_hide_review_notification'])) {
|
413 |
+
echo '<div class="main-sidebar">';
|
414 |
+
include 'assets/sidebar.php';
|
415 |
+
echo '</div>';
|
416 |
+
}
|
417 |
+
?>
|
418 |
|
419 |
</div>
|
420 |
|
444 |
foreach ( array('sa_element') as $option_name ) {
|
445 |
if ( isset( $_POST[$option_name] ) ) {
|
446 |
$options[$option_name] = sanitize_text_field( $_POST[$option_name] );
|
447 |
+
}
|
448 |
}
|
449 |
|
450 |
foreach ( array('sa_topspace') as $option_name ) {
|
474 |
foreach ( array('sa_pushup') as $option_name ) {
|
475 |
if ( isset( $_POST[$option_name] ) ) {
|
476 |
$options[$option_name] = sanitize_text_field( $_POST[$option_name] );
|
477 |
+
}
|
478 |
}
|
479 |
|
480 |
foreach ( array('sa_adminbar') as $option_name ) {
|
512 |
foreach ( array('sa_tab') as $option_name ) {
|
513 |
if ( isset( $_POST[$option_name] ) ) {
|
514 |
$options[$option_name] = sanitize_text_field( $_POST[$option_name] );
|
515 |
+
}
|
516 |
}
|
517 |
|
518 |
$tabValue = $_POST['sa_tab'];
|
519 |
|
520 |
+
update_option( 'sticky_anything_options', $options );
|
521 |
wp_redirect( add_query_arg(
|
522 |
array('page' => 'stickyanythingmenu', 'message' => '1', 'tab' => $tabValue),
|
523 |
+
admin_url( 'options-general.php' )
|
524 |
)
|
525 |
+
);
|
526 |
|
527 |
exit;
|
528 |
}
|
542 |
wp_enqueue_script('stickyAnythingAdminScript');
|
543 |
|
544 |
wp_register_style('stickyAnythingAdminStyle', plugins_url('/assets/css/sticky-anything-admin.css', __FILE__) );
|
545 |
+
wp_enqueue_style('stickyAnythingAdminStyle');
|
546 |
}
|
547 |
}
|
548 |
|
549 |
+
/**
|
550 |
+
* Helper function for adding plugins to featured list
|
551 |
+
*
|
552 |
+
* @return array
|
553 |
+
*/
|
554 |
+
function sticky_featured_plugins_tab($args)
|
555 |
+
{
|
556 |
+
add_filter('plugins_api_result', 'sticky_plugins_api_result', 10, 3);
|
557 |
+
|
558 |
+
return $args;
|
559 |
+
} // sticky_featured_plugins_tab
|
560 |
+
|
561 |
+
|
562 |
+
/**
|
563 |
+
* Add single plugin to featured list
|
564 |
+
*
|
565 |
+
* @return object
|
566 |
+
*/
|
567 |
+
function sticky_add_plugin_featured($plugin_slug, $res)
|
568 |
+
{
|
569 |
+
// check if plugin is already on the list
|
570 |
+
if (!empty($res->plugins) && is_array($res->plugins)) {
|
571 |
+
foreach ($res->plugins as $plugin) {
|
572 |
+
if (is_object($plugin) && !empty($plugin->slug) && $plugin->slug == $plugin_slug) {
|
573 |
+
return $res;
|
574 |
+
}
|
575 |
+
} // foreach
|
576 |
+
}
|
577 |
+
|
578 |
+
$plugin_info = get_transient('wf-plugin-info-' . $plugin_slug);
|
579 |
+
|
580 |
+
if (!$plugin_info) {
|
581 |
+
$plugin_info = plugins_api('plugin_information', array(
|
582 |
+
'slug' => $plugin_slug,
|
583 |
+
'is_ssl' => is_ssl(),
|
584 |
+
'fields' => array(
|
585 |
+
'banners' => true,
|
586 |
+
'reviews' => true,
|
587 |
+
'downloaded' => true,
|
588 |
+
'active_installs' => true,
|
589 |
+
'icons' => true,
|
590 |
+
'short_description' => true,
|
591 |
+
)
|
592 |
+
));
|
593 |
+
if (!is_wp_error($plugin_info)) {
|
594 |
+
set_transient('wf-plugin-info-' . $plugin_slug, $plugin_info, DAY_IN_SECONDS * 7);
|
595 |
+
}
|
596 |
+
}
|
597 |
+
|
598 |
+
if (!empty($res->plugins) && is_array($res->plugins) && $plugin_info && is_object($plugin_info)) {
|
599 |
+
array_unshift($res->plugins, $plugin_info);
|
600 |
+
}
|
601 |
+
|
602 |
+
return $res;
|
603 |
+
} // sticky_add_plugin_featured
|
604 |
+
|
605 |
+
|
606 |
+
/**
|
607 |
+
* Add plugins to featured plugins list
|
608 |
+
*
|
609 |
+
* @return object
|
610 |
+
*/
|
611 |
+
function sticky_plugins_api_result($res, $action, $args)
|
612 |
+
{
|
613 |
+
remove_filter('plugins_api_result', 'sticky_plugins_api_result', 10, 3);
|
614 |
+
|
615 |
+
$res = sticky_add_plugin_featured('wp-external-links', $res);
|
616 |
+
$res = sticky_add_plugin_featured('wp-force-ssl', $res);
|
617 |
+
$res = sticky_add_plugin_featured('eps-301-redirects', $res);
|
618 |
+
$res = sticky_add_plugin_featured('simple-author-box', $res);
|
619 |
+
|
620 |
+
return $res;
|
621 |
+
} // sticky_plugins_api_result
|
622 |
+
|
623 |
+
|
624 |
+
function sticky_hide_review_notification() {
|
625 |
+
if (false == wp_verify_nonce(@$_GET['_wpnonce'], 'sticky_hide_review_notification')) {
|
626 |
+
wp_die('Please click back, reload the page and try again.');
|
627 |
+
}
|
628 |
+
|
629 |
+
$sticky_anything_options = get_option( 'sticky_anything_options' );
|
630 |
+
$sticky_anything_options['sa_hide_review_notification'] = true;
|
631 |
+
update_option('sticky_anything_options', $sticky_anything_options);
|
632 |
+
|
633 |
+
if (!empty($_GET['redirect'])) {
|
634 |
+
wp_safe_redirect(esc_url($_GET['redirect']));
|
635 |
+
} else {
|
636 |
+
wp_safe_redirect(admin_url('options-general.php?page=stickyanythingmenu'));
|
637 |
+
}
|
638 |
+
|
639 |
+
exit;
|
640 |
+
} // sticky_hide_review_notification
|
641 |
|
642 |
/**
|
643 |
* === HOOKS AND ACTIONS AND FILTERS AND SUCH ==========================================================
|
644 |
*/
|
645 |
|
646 |
+
$plugin = plugin_basename(__FILE__);
|
647 |
|
648 |
register_activation_hook( __FILE__, 'sticky_anthing_default_options' );
|
649 |
add_action('init','sticky_anything_update',1);
|
652 |
add_action('admin_init', 'sticky_anything_admin_init' );
|
653 |
add_action('admin_enqueue_scripts', 'sticky_anything_styles' );
|
654 |
add_filter("plugin_action_links_$plugin", 'sticky_anything_settings_link' );
|
655 |
+
add_filter('install_plugins_table_api_args_featured', 'sticky_featured_plugins_tab');
|
656 |
+
add_action('admin_action_sticky_hide_review_notification', 'sticky_hide_review_notification');
|
uninstall.php
CHANGED
@@ -1,7 +1,8 @@
|
|
1 |
<?php
|
2 |
-
if ( !defined( 'WP_UNINSTALL_PLUGIN' ) )
|
3 |
-
|
|
|
|
|
4 |
if ( get_option( 'sticky_anything_options' ) != false ) {
|
5 |
delete_option( 'sticky_anything_options' );
|
6 |
}
|
7 |
-
?>
|
1 |
<?php
|
2 |
+
if ( !defined( 'WP_UNINSTALL_PLUGIN' ) ) {
|
3 |
+
exit;
|
4 |
+
}
|
5 |
+
|
6 |
if ( get_option( 'sticky_anything_options' ) != false ) {
|
7 |
delete_option( 'sticky_anything_options' );
|
8 |
}
|
|