Startseite › Toolset Professional Support › [Gelöst] responsive slider
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Heute stehen keine Supporter zur Arbeit im Werkzeugsatz-Forum zur Verfügung. Sie können gern Tickets erstellen, die wir bearbeiten werden, sobald wir online sind. Vielen Dank für Ihr Verständnis.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | - |
- | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | - |
Supporter timezone: Europe/London (GMT+00:00)
Tags: Sliders, Views plugin
Verwandte Dokumentation:
Dieses Thema enthält 15 Antworten, hat 2 Stimmen.
Zuletzt aktualisiert von Nigel vor 5 Jahren, 2 Monaten.
Assistiert von: Nigel.
Hi I'm looking for the option to build a responsive slider, I'm using divi and toolset.
the Standard slider is not responsive, I'm using 4 items in a row for desktop and want to use 2 for tablets and one for mobile.
I've found this in the forum: versteckter Link
but I'm not sure where to add and how to handle it.
Do you have some hint or a tutorial for it?
Thanks Andi
Sprachen: Englisch (English ) Spanisch (Español )
Zeitzone: Europe/London (GMT+00:00)
Hi Andi
I took a quick look at the documentation.
This is the key page: versteckter Link
Note the expected HTML structure, with a container div with the class .owl-carousel and its child elements, which are the individual slides.
You need to reproduce this kind of HTML structure.
How you do that depends rather on whether your slides are posts, or repeating fields (images) of a single post.
Can you first clarify that, and then I can give you some more direction.
Hi NIgels, thanks for your reply.
I will build it with post resp. CPT.
Best Regards
Andreas
the plan is to show it in the following way:
desktopview:
post1 post2 post3 post4
tabletview:
post1 post2
mobileview:
post1
and than slide to the next posts....
Sprachen: Englisch (English ) Spanisch (Español )
Zeitzone: Europe/London (GMT+00:00)
Hi Andreas
I'm not sure exactly how much control that slider gives you over how many slides are shown on different sized screens, you'll have to refer to its documentation, but while testing their demos I can see that it changes the number of visible slides according to the screen size, so it should give you the basics of what you need.
So, this slider is to display fields from separate posts as slides then it should be fairly straightforward.
You will create a View to output the posts to be used for the slides.
Recall you need to reproduce markup that looks something like this:
<div class="owl-carousel"> <div> Your Content </div> <div> Your Content </div> <div> Your Content </div> <div> Your Content </div> <div> Your Content </div> <div> Your Content </div> <div> Your Content </div> </div>
i.e. you need one wrapper div with the required class, and then each slide (post) in its own div.
So use the Loop Wizard and choose unformatted for the output format, and group the fields together in a content template.
Add an inner wrapper div (such as surrounds each "Your Content" above) and then the fields for your slide.
No go back to the Loop Editor and add the outer wrapper div on either side of the wpv-loop tags, meaning this wrapper gets added just once, not for each iteration.
If you were to display this View on the front end you should see that it has output *all* of the slides, effectively in a list.
Then comes the part of using the slider library.
The first part is to add the required CSS and JS.
In the documentation it describes linking to the required files (versteckter Link), but you shouldn't add CSS and JS like that in WordPress, you should enqueue the files as described in the WordPress documentation (https://developer.wordpress.org/themes/basics/including-css-javascript/).
Then in a custom JS section of your View you can initialise the slider as described in versteckter Link
You shouldn't rely on jQuery being initialised already, you should add JS code like this instead:
( function( $ ) { $( document ).ready( function(){ $(".owl-carousel").owlCarousel(); }); })( jQuery );
hmm, something I'm doing wrong!
I've taken now this as Loop:
[wpv-layout-start] [wpv-items-found] <!-- wpv-loop-start --> <div class="owl-carousel"> <wpv-loop> [wpv-post-body view_template="FacebookEventSliderResponsive - Slide"] </wpv-loop> </div> <!-- wpv-loop-end --> [/wpv-items-found] [wpv-no-items-found] <strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong> [/wpv-no-items-found] [wpv-layout-end]
and this as template for the view:
<div class="slider_item"> <a href="[wpv-post-url]" class="slider_container"> <div class="slider_image_overlay_container"> <img class="slider_icon" src="<em><u>versteckter Link</u></em>" alt="AKWB e.V."> <h4 class="slider_title">[wpv-post-title]</h4> <p class="slider_information"> <span class="slider_information_title">Datum: </span> [wpv-conditional if="( '[wpv-post-field name='start_ts']' eq 'Invalid Date' )"]<span class="slider_information_content">[wpv-post-field name='event_start_date']</span>[/wpv-conditional] [wpv-conditional if="( '[wpv-post-field name='start_ts']' neq 'Invalid Date' )"]<span class="slider_information_content">[wpv-post-field name='start_ts']</span>[/wpv-conditional] </p> </div> <div class="slider_image_container" style="background-image: url([wpv-conditional if="( '[wpv-post-featured-image output="url"]' eq '' )"]<em><u>versteckter Link</u></em> if="( '[wpv-post-featured-image output="url"]' ne '' )"][wpv-post-featured-image size="et-pb-portfolio-module-image" output="url"][/wpv-conditional]);"> </div> </a> </div>
but the slider don't show anything.
When I delete the two divs for '<div class="owl-carousel">' it works fine.
Sprachen: Englisch (English ) Spanisch (Español )
Zeitzone: Europe/London (GMT+00:00)
It looks as if that should be generating the correct markup, which leads me to suspect something is wrong with enqueuing or initialising the slider library.
Could I see a link to this on the front-end (with everything setup, including the wrapper div)?
Hi Nigel, please try this one:
versteckter Link
Sprachen: Englisch (English ) Spanisch (Español )
Zeitzone: Europe/London (GMT+00:00)
It looks as if you are mixing up Views pagination and the Owl slider rather than using one or the other, but I can't be sure from looking at the front-end alone.
Can I get credentials to look at the back-end to see how you have set this up?
I will mark your next reply as private so that I can get log-in credentials from you—you may want to create a temporary admin user for me to use that you can later delete. And be sure to have a current backup of your site.
Sprachen: Englisch (English ) Spanisch (Español )
Zeitzone: Europe/London (GMT+00:00)
Unfortunately those site credentials are not working, I cannot log in.
Could you edit that last reply and update them?
Oh, sorry.
I've seen it hasn't execute it in the right way.
Now the credentials from above will work.
Sorry and Cheers
Andreas
Sprachen: Englisch (English ) Spanisch (Español )
Zeitzone: Europe/London (GMT+00:00)
Sorry, I'm confused.
I understood that you had been using Views to create a slider, but the slider wasn't responsive and so you wanted to use a slider JavaScript library you had found (OwlCarousel2) and you wanted help to set up the View so that it could output content that could be used by this library to create a responsive slider.
But examining your site, it seems that you have a Divi extension that provides the OwlCarousel slider (in the Divi global module you linked to). It appears to be a self-contained slider, querying the facebook event posts itself to produce a slider of them.
So I don't understand why you are also linking to a View, and what you expect this View to do. It looks like a hybrid of a slider View (where Views creates a slider) and a View that uses OwlCarousel. But it must be one or the other, it cannot be both, and I don't understand why you need it anyway if you already have a Divi OwlCarousel slider for the same content. If you want this View to be an OwlCarousel slider then you must remove the pagination from the View so that it outputs all results at once.
Hi Nigel,
yes I'm using the Divi-Plugin to give my customer the results, but I would prefer to to this without that plugin. It is just a workaround for a fast result.
So where I have to add that js for the slider? I've understood it in that way, that I have to build a slider by toolset and to add the js. I have now deactivated the pagination in the view "eventslider" but is doesn't help.
So I want to build a responsive slider by toolset. I try to avoid using other plugins for that, but in the moment I do need that, 'cause I have to show some results to my customer. When we were able to build a slider by toolset the other plugin will be deleted. I prefer just a small number of plugins and I do need toolset, so I want to delete as many other plugins as possible.
Maybe I've understood it wrong how to build that responsive slider by toolset and that OwlCarousel2.
Is there a chance to build a step-by-step tutorial? I think I'm not the only one who is searching for a slider like that...
Sprachen: Englisch (English ) Spanisch (Español )
Zeitzone: Europe/London (GMT+00:00)
OK, on your site I created a test View "Owl Event Slider" which shows the basics for getting this slider library to work.
Note the custom JS used to initialise the slider, which includes one option to display the navigation.
I inserted that View into the page "Owl Event Slider test".
Note that I hard-coded the links to the CSS and JS resources before inserting the View, although as I pointed out in my initial reply you should be enqueuing these assets according to the normal WordPress techniques.
Visiting that page on the front-end you can see it works. You can see 3 slides, and you can drag to navigate between the slides.
It doesn't seem to be responsive, but you probably have to set up the options for responsiveness according to the documentation for the slider, I'm not familiar with it.
Hi Nigel, sorry for the delay, but I was working on some other things in the last days, but I will work on that site from tomorrow til the weekend.
Best Regards
Andreas