Create Custom Slider using sidebar / text-widgets
-
I work for a small company that develops websites for clients and I ran across an interesting issue today and was wondering if the solution I was thinking of is possible.
I know that it’s fairly simple to create a custom slider using bootstrap / php to query post types and display a limited number of posts to create a slider on a page. We’ve done this for multiple clients but one of our latest projects had over 50 different items created with text-widgets.
On one page the sidebar is called and all of the text-widgets are displayed and that is fine BUT the client would like to have 3 of these to be displayed on the homepage at random, cycling through just like a slider with all of the items available to be viewed from the homepage.
Is it possible to somehow call the sidebar and query through the text-widgets to display their content on the homepage like we are wanting OR is this only possible through a post query?
I’m sorry if I’m using incorrect syntax or wording on some of this, still in the process of learning!
Thank you in advance for any feedback!
-
Hello, You can always create a custom widget and display whatever you want in them along with custom options.
You cannot query widgets like posts, but you could get the complete sidebar output in the main home page area by essentially making the entire page a “sidebar”. As far as widgets are concerned, a sidebar is simply an area which displays widgets. It’s up to CSS to style it like a traditional sidebar. It can just as well be a header or footer area as a sidebar. Even the main content area can be a sidebar with the right CSS.
The widget output is defined on the widget admin panel. When you call for sidebar output, that’s what you get. You cannot arbitrarily pick and choose which output to use elsewhere, it’s all or nothing. However, CSS and JavaScript can be used to show or hide particular elements, in effect creating the slideshow you are after.
Thank you for the reply.
We have already created a widget area (sidebar) and have all of the content put into the built in text widgets. We know how to display the content statically.
What we are trying to accomplish is using the widget area to display 3 out of the 50 widgets at a time, cycling through them much like a slider. I’m not sure if it is possible to ONLY display a few of the widgets at a time and filter through them randomly.
After reading the information about the widgets I feel like this may be possible but the customization of how you can display widgets doesn’t seem to be directly addressed.
I think this is exactly what I was looking for. Thank you for the reply! I wasn’t sure if it was an ‘all or nothing’ situation and I’m sure we can develop some sort of JS solution that will meet our needs. If not, custom posts are inbound!
Thank you for the quick reply and succinct explanation.
The topic ‘Create Custom Slider using sidebar / text-widgets’ is closed to new replies.