You can achieve this with pure CSS. It’s a solid alternative to your question.
Depending if your widget has a unique ID (like id="widget-358"
or id="my-video-widget"
), you can set up CSS rules to make it float in a fixed position on the screen:
#my-video-widget {
/* required */
position: fixed;
/* change to your needs */
top: 0px; /* to float it from the bottom of the screen, use the 'bottom' directive */
left: 0px; /* to float it on the right hand side, use the 'right' directive */
/* optional */
z-index: 10; /* depends if elements on your page are already layered, and if you want your video to float above everything else */
}
If your widget does not have a unique identifier, you may risk affecting other widgets or elements, so I advise you put a unique name in either the class
or id
(id
makes much more sense).
Related Posts:
- Between functions.php (theme), widgets, and plugins, which is loaded first?
- Plugin upgrading: Widget settings
- Simple rich text editor in Text widget?
- How To Determine If A Filter Is Called In A Sidebar/Widget Context?
- How can I make my custom shortcode work in a Custom HTML Widget?
- Need to create a Theme demo site that features multiple themes
- Disable Specific Widgets on Selected Pages of a WordPress Website?
- Override dynamic_sidebar() in plugin?
- How do I add a widget programmatically to a newly created site (WPMU) within a plugin?
- How to place random widgets in the WordPress sidebar?
- Override Widget class in plugins with custom plugin
- Pages with 2 Columns
- Can I ignore caching of a plugin in W3 Total Cache? [closed]
- Why is the unrendered widget number `__i__` showing up in the JavaScript but not in the HTML?
- Remove Widgets in Dashboard
- Themes VS Plugins [duplicate]
- Changing widget options via the functions.php when there are no hooks
- How do I register a stylesheet inside a WordPress widget?
- Detect if a plugin was included in a certain page
- Flickr plugin that will display photos from multiple group pools? [closed]
- Multisite Widget/Content
- WordPress author details plugin/widget
- Widget for adding HTML markup to a page
- Get post values of form created by widget in sidebar
- Archive – same title for the first two posts
- How to display more than one instance for a widget?
- How to add media field to WP_Widget form function?
- changes to widget settings not showing up in individual pages pages until they’re updated [closed]
- Calendar Plugins – Featured Widget [closed]
- Widgets Scripts don’t load – but load when I reload the page
- WordPress plugin subscribe2 not looking the same as before migration
- Setup page on first login on multisite
- How can I inject options into an select tag inside the widget form?
- Add content to footer – above wp_footer
- Trying to create a table/list of my EventBrite course listings [closed]
- Hide certain widgets from specific user roles in admin
- How do I find out what is in control over a certain part of a website?
- Call plugin with php function
- Sidebar widget: Randomly select text from a given set
- How do I use add_action on custom widget?
- Repeated Output in Widget
- Exclude posts from widget while post is showing on home, single and categories
- Custom widget doesn’t save values from dropdown box
- WordPress Apply filter in plugin causes 500 internal error
- Creating a widget and missing jQuery
- jQuery Click event is not fired at all
- strange shortcode error: does shortcodes requires any dependency?
- All custom widgets are not showing in widget area at the same time
- Widget for specific category
- Plugin showing error
- get_term_meta returns false in widget
- How to set the default value as the saved value once a form of widget is saved?
- My widget won’t update its values when save is clicked
- Accessing widget information
- Extend a plugin to include a widget option
- Is there a Image Gallery which will load all my posted Images like twitter’s image grid?
- Setting text widget to one page only
- How to add captcha to publish widget
- Listing all sidebars
- Unable to locate inline CSS causing parts of page to be blank
- Table of contents (TOC) plugin is not showing header tag
- Widgets are not displaying in the admin panel
- Elementor pro page editing gives error There has been a critical error on this website. Please check your site admin email inbox for instructions
- Can I add Short Code Of A Plugin In The Code Editor of WordPress?
- How to fetch WordPress database values in JavaScript widget
- Adding custom post category to categories widget
- Update widget values from ajax function
- The styles in the recent posts widgets plugin not working
- What is the right way to populate a dropdown from MySql?
- How to disable a widget area of a specific page?
- Change WordPress plugin widget `id_base` without breaking widget
- Co-author plus: list of posts by authors in the sidebar
- Widget display in theme
- Hook on widget context plugin to add custom context for widget
- Widget outputs the value but doesn’t save anything inside the textarea
- How to add styling and script to a custom widget plugin
- WordPress Widget: Is it possible to make the form dynamic without updating?
- Using Widget Logic to place menu on multiple pages?
- Customize a widget position
- Adding link on title its in description but not in title see screenshots attached
- Show widget location borders for development
- Cannot access variables within a widget
- How know the “admin” blog from wordpress multisite?
- twitter widget loads properly in all themes except my own theme?
- How can I retrieve data within my widget
- adding image in the header of my dev widget
- Plugin: Unable to Save the Image Alignment Option to Display in the Widget in the Sidebar
- How to get certain part from widget
- conditional tags for the output of a plugin
- What method should I use for a sidebar widget that reads latest posts?
- pre-upload text and video for the future
- Last article Widget with text preview and more button
- Scrolling Ads? Live scrolling widget, not random on refresh
- What are the downsides of using bootstrap in plugin development?
- Can’t edit Contact Us form on front page
- Sidebar Slideshow widget with text [closed]
- Issue with customizer and widget page
- Footer option is missing in Customiser
- Use custom Javascript for a custom Elementor Widget [closed]
- Why my widget is not visible in the WordPress theme Twenty Twenty-Three