Use Fixed Widget to create sticky widgets, sticky blocks, and other elements that stay in the visible screen area when a user scrolls the page up or down.
Sticky widgets are more visible than unfixed widgets and therefore have a significantly higher click-through rate.
That’s why this option is worthwhile for ads or other elements that visitors should interact with. Meanwhile, Google also allows the integration of sticky AdSense ads.
Fixed Widget is completely free of charge.
- Sticky Widgets Use the Fixed Widget option on any widget and blocks in the sidebar
- Sticky Elements Choose any element on your site and make it sticky
- Margin Top allows you to stop sticky elements to cover floating menu bars
- Margin Bottom pushes sticky elements up before they reach a certain distance towards the bottom window
- Stop Elements push sticky elements up when they are scrolling into view
- Stop Blocks defines blocks in your sidebar that push fixed blocks out of the page
- Minimum Screen Width and Minimum Screen Height allow you to disable sticky behavior on small screens
- Follow the standard WordPress plugin installation procedure
- Activate the plugin through the plugins menu in WordPress
- Go to Appearance -> Widgets, enable the “Fixed Widget” option on any active widget
- Fine tune plugin parameters on Appearance -> Fixed Widget page
Why is the Fixed Widget plugin not working?
There are several reasons:
wp_footer()functions in template. Check header.php and footer.php files of your active theme.
- Conflicts with other plugins and scripts
- CSS incompatibility
Is it possible to fix multiple widgets?
Yes, it is possible to fix more than one widget even if they are located in different sidebars.
How can I style a fixed element only while it is sticky?
Fixed elements carry the
FixedWidget__fixed_widget__pinnedclass, which allows developers to change the styling only while the element is fixed.
Go to WP admin area, Appearance -> Fixed Widget. Here you can define the top and bottom margins. Set bottom margin value >= footer height. Check the result, please.
If your footer height is changing from page to page it is better to use the
Stop IDoption. Here you need to provide the HTML tag ID. The position of that HTML element will determine the margin bottom value. For example, let’s take the Twenty Sixteen default theme. The theme’s footer container has an ID=”colophon”. In the
Stop Element Selectorsoption I need to enter
How to disable the plugin on mobile devices?
Use the options
Minimum Screen Widthand
Minimum Screen Heightto disable sticky features when the browser window is too small. You can also use the visitor conditions of Advanced Ads to target specific devices.
Contributors & Developers
“Fixed Widget and Sticky Elements for WordPress” is open source software. The following people have contributed to this plugin.Мүчөлөрү
“Fixed Widget and Sticky Elements for WordPress” has been translated into 22 locales. Thank you to the translators for their contributions.
Interested in development?
- Fix: fixed widget might increase its height when scrolling
- Fix: improve bottom offset calculation when scrolling up
- Fix: widget height increasing
- Fix: widget scrolling align position
- Fix: compatibility with existing CSS transition rules
- Improvement: requires PHP 7.2
- Fix: various improvements in cases where the fixed widget flickered, or the height was could not be determined correctly
- Improvement: reposition the fixed widget when the screen is resized, e.g., a mobile device turned into landscape mode
- Improvement: various optimizations for specific themes and setups reported by users
- Feature: Add the
FixedWidget__fixed_widget__pinnedclass to the fixed widget while it is sticky and remove it when it is unfixed. This allows users to apply their own styling only during a fixed state.
- Improvement: rename “Test new version” option into “Improved version” and changed the option description to make it more clear that both script versions will be kept.
- Improvement: change “Fixed Widget Options” menu item into “Fixed Widget”
- Improvement: Handle edge cases where the Minimum Width option doesn’t work for specific themes
- Improvement: Compatibility with relative padding values
- Improvement: Compatibility with dynamically loaded content pages, i.e., infinite scroll
- Improvement: Compatibility with widgets that have large offsets
- Fix: Prevent padding from increasing on scroll
- Fix: Prevent overlapping of fixed widgets with non-fixed widgets when scrolling up
- Fix: Prevent fixed widgets overlapping non-fixed elements in certain themes
- Fix: Class selectors saved under the Custom Elements were wrongly prefixed with ‘#’
- Improvement: Check lazy elements and stop elements for changing their size and recalculate fixed position
- Improvement: Lower check interval from 1000 to 500 ms
- Improvement: Fall back to previous version when the theme does not support the new script – mainly because of using float instead of flex
- Improvement: Stop Elements work also when they are in a different column or sidebar than the fixed element
- Improvement: Recalculate Fixed Widget height on scroll
- Fix: use the previous Stop ID value in the new Stop Elements section
Version 6.0.0 is a full rewrite of the frontend script. It fixes many edge cases like jumping, reloading, or resizing widgets.
The rewrite also resolves bad Cumulative Layout Shifts.
Most changes are available when you enable “Improved version” under Appearance > Fixed Widget.
Please test and let us know if you discover any issues.
- added new (and optional) script version that uses
position: stickyinstead of
- the frontend script does not need jQuery anymore
- removed unneeded options that previously helped resolving edge cases
- “Stop Elements” and “Custom Fixed Elements” now accept any selector, including IDs, Class, and Type selectors.
- fixed blocks in sidebars as introduced in WordPress 5.8
- define stop blocks in sidebars that move up fixed blocks on scrolling
- improved option descriptions on the admin page
- improved behavior for elements higher than the screen – they first stick at the top and scroll to the bottom later
- removed duplicating widget code
- fixed option not saving when using the Gutenberg plugin to edit sidebars with block editor
- disabled scripts and output on AMP pages since sticky widgets are not part of the AMP standard
- removed explicit translation files since all translations are handled through https://translate.wordpress.org/projects/wp-plugins/q2w3-fixed-widget/
q2w3-fixed-widget-sidebar-optionsfilter for widget options in the frontend.
- Fixed “a.target.className.indexOf is not a function” bug
- linguistic corrections
- cleanup of the options page
- author change
- Added filter “q2w3-fixed-widgets”. It allows to filter array of widgets marked as fixed.
- Now compatible with WP Page Widget plugin
- Now works fine with Shortcodes Ultimate widgets!
- Resolves problems with Margin Bottom and Stop ID from version 5.1!
- New options load method!
- Tested with WordPress 4.9
- Compatibility patch for Better WordPress Minify plugin.
- Improved solution for “q2w3_sidebar_options is not defined” error.
- To resolve “q2w3_sidebar_options is not defined” error
wp_add_inline_scriptfunction is used. WordPress 4.5 required for this fix!
- Added option
Disable MutationObserver. Use this option only as a backup to restore version 4 behavior!
- Fixed problem in multiple sidebars layout
- Optimized client side performance. Detection of page changes is now based on MutationObserver API. Widget parameters recount is fired only when needed! Refresh interval option used only for campatibility with old browsers (no MutationObserver API support).
- Improved compatibility with caching plugins (W3TC, Autoptimize and etc.). No need to exclude jQuery and plugin files from cache!
- Async/Defer script load method support
- Note for cache plugins users: don’t forget to clear cache after upgrading to version 5! Options format has been changed!
Stop IDoption. Use it when you cannot specify
Margin Bottomvalue. Solution provided by Julian_Kingman!
- Now the plugin is aware of the WordPress admin bar presence!
- Fixed destruction of
jQuery(window).loadhook. There should be no problems with other jQuery plugins now!
- Added German translation
- Updated internationalization support
- A small bug fix
- Added French translation
- New option “Inherit widget width from the parent container” to better support responsive layouts.
- Added option “Auto fix widget id”. It is on by default. If the plugin is working with this option switched off – leave it in off position!
- Optimized code to resolve plugin crash after 4.0.1 update problem
- Hotfix! Removes problem with duplicated widget code.
- Resolved widget jumping
- Added code to automatically fix “widget id problem”
- Added new compatibility option (plugin priority)
- Added complete uninstall (uninstall script launched automatically when you DELETE plugin)
- Added Spanish translation
- Removed depricated options
- This version brings you a long waited capability to stick widgets located in different sidebars! Enjoy!
- Fixed conflict with WP Page Widget plugin
- A few small bugs cleaned
- Warning! “Disable plugin on mobile devices” and “Disable plugin on tablet devices” options now are depricated and will be removed in the next release. Use “Screen Max Width” option instead!
- Now user can disable plugin, when browser window width is less then specified value (check plugin options).
- This version compatible with jQuery 1.9 and 1.10
- Little internal improvments
- Mobile Detect updated to version 2.6.0
- Fixed PHP Error
- Mobile Detect updated to version 2.5.8
- Fixed PHP Warning
- Added new option to plugin settings: Refresh interval. Recommended values between 500 – 2000 milliseconds. Note: setting have impact on the site performance (client side). If you don’t have dynamic content, set Refresh interval = 0.
- Mobile Detect class updated to version 2.5.7
- New option to define custom widget IDs for static sidebars and etc.
- New option to disable plugin on mobile devices.
- Fixed footer overlapping problem! Now users can customize top and bottom margins for the fixed widgets from the admin area (Appearance -> Fixed Widget).
- Added localization support
- Normalized plugin behavior when sidebar is longer then main content. Note: possible overlapping with footer is still exists.
- Fixed problem with widgets displayed only on certain pages.
- Improved compatibility with Webkit based browsers (like Chrome and Safari).
- Removed unnecessary CSS.
- First public release.