Vertical Carousel in Oxygen using Slick

le 26/10/2021
JAG

In the Oxygen Slack workspace, a user asked:
Guys, I’m in a bit of a pickle. I’ve now bought 3 different vertical carousel/slider plugins. The last one was ROYAL SLIDER on code canyon. None of them work well (Royal Slider not at all) with Oxygen.Any recommendations for a plugin which can display 3 images at a time in a vertical carousel?
The user also wanted only the down arrow at the bottom to appear.
In this tutorial, I show how Slick JS can be used to display entries of Easy Posts element as a vertical carousel in Oxygen.

Step 1
Edit your Oxygen template and add a Section and inside that, Easy Posts and Code Block elements.

Bring up the Structure tree and click on the Easy Posts element.
Select your desired post type and the number of entries in the Easy Posts element.
In my test site, I have
a) set the preset to “List – Standard (Centered)”b) custom selected for WP Query with portfolio Post Type and Count as 6c) set max-width to 400px in Advanced > Size & Spacingd) edited the Template PHP to display the featured image and title both linked to the permalink



and the Template CSS:
%%EPID%% .oxy-posts {
display: flex;
flex-direction: column;

}

%%EPID%% .oxy-post {
display: flex;
flex-direction: column;
text-align: center;
align-items: center;
margin-bottom: 2em;
}

%%EPID%% .oxy-post-image {
margin-top: 1em;
margin-bottom: 1em;
width: 100%;
}

%%EPID%% .oxy-post-title {
font-size: 2em;
line-height: 1.2em;
}
Step 2
Install and activate my custom functionality plugin.
a) Connect to your server using a FTP client and upload
i) ajax-loader.gif to plugin’s assets/images directory.ii) slick.css to plugin’s assets/css directory.iii) slick.min.js to plugin’s assets/js directory.
b) Create a file named slick-theme.css in assets/css having the following:
@charset 'UTF-8';

/* Slider */

.slick-loading .slick-list {
background: #fff url('./images/ajax-loader.gif') center center no-repeat;
}

/* Arrows */

.slick-prev,
.slick-next {
/* font-size: 0;
line-height: 0; */
position: absolute;
left: 50%;
display: block;
/* width: 20px;
height: 20px; */
padding: 0;
-webkit-transform: translate(0, -50%);
transform: translate(0, -50%);
cursor: pointer;
/* color: transparent; */
border: none;
outline: none;
background: transparent;
}

.slick-prev:hover,
.slick-prev:focus,
.slick-next:hover,
.slick-next:focus {
/* color: transparent; */
outline: none;
background: transparent;
}

.slick-prev:hover:before,
.slick-prev:focus:before,
.slick-next:hover:before,
.slick-next:focus:before {
opacity: 1;
}

.slick-prev.slick-disabled:before,
.slick-next.slick-disabled:before {
opacity: .25;
}

.slick-prev:before,
.slick-next:before {
/* font-family: 'slick';
font-size: 20px;
line-height: 1;

opacity: .75;
color: #000;

-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; */
display: inline-block;
font-style: normal;
font-variant: normal;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
font-family: "Font Awesome 5 Free";
font-weight: 900;
opacity: .75;
font-size: 24px;
}

.slick-next {
top: -25px;
display: none !important;
}

[dir='rtl'] .slick-prev {
right: -25px;
left: auto;
}

.slick-prev:before {
content: 'f078';
}

[dir='rtl'] .slick-prev:before {
content: '→';
}

.slick-prev {
bottom: -55px;
}

[dir='rtl'] .slick-next {
right: auto;
left: -25px;
}

.slick-next:before {
content: 'f077';
}

[dir='rtl'] .slick-next:before {
content: '←';
}

/* Dots */

.slick-dotted.slick-slider {
margin-bottom: 30px;
}

.slick-dots {
position: absolute;
bottom: -25px;
display: block;
width: 100%;
padding: 0;
margin: 0;
list-style: none;
text-align: center;
}

.slick-dots li {
position: relative;
display: inline-block;
width: 20px;
height: 20px;
margin: 0 5px;
padding: 0;
cursor: pointer;
}

.slick-dots li button {
font-size: 0;
line-height: 0;
display: block;
width: 20px;
height: 20px;
padding: 5px;
cursor: pointer;
color: transparent;
border: 0;
outline: none;
background: transparent;
}

.slick-dots li button:hover,
.slick-dots li button:focus {
outline: none;
}

.slick-dots li button:hover:before,
.slick-dots li button:focus:before {
opacity: 1;
}

.slick-dots li button:before {
font-family: 'slick';
font-size: 6px;
line-height: 20px;
position: absolute;
top: 0;
left: 0;
width: 20px;
height: 20px;
content: '•';
text-align: center;
opacity: .25;
color: black;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

.slick-dots li.slick-active button:before {
opacity: .75;
color: black;
}
c) Edit plugin.php and add
wp_enqueue_style(
'slick-css',
plugin_dir_url( __FILE__ ) . 'assets/css/slick.css'
);

wp_enqueue_style(
'slick-theme-css',
plugin_dir_url( __FILE__ ) . 'assets/css/slick-theme.css'
);

wp_enqueue_script(
'slick',
plugin_dir_url( __FILE__ ) . 'assets/js/slick.min.js',
array( 'jquery' ),
'1.9.0',
true
);
inside custom_enqueue_files() function.
We shall load Font Awesome for the down arrow button. Add
add_action( 'wp_enqueue_scripts', 'custom_load_font_awesome' );
/**
* Enqueues Font Awesome.
*/
function custom_load_font_awesome() {

wp_enqueue_style( 'font-awesome', '//use.fontawesome.com/releases/v5.1.0/css/all.css' );

}
at the end in plugin.php.
Step 3
Back in Oxygen, click on the Code Block element.
Delete

from the PHP & HTML area.
In the JavaScript area, add
jQuery(".oxy-posts").slick({

vertical: true,
verticalSwiping: true,
slidesToShow: 3,
slidesToScroll: 3,
nextArrow: '',
prevArrow: '',

});
Reference: https://sridharkatakam.com/load-font-awesome-5-wordpress/

Nos experts se tiennent à votre disposition
pour répondre à vos questions et vous conseiller
dans votre projet digital.

Vous souhaitez développer une application ?

Envie d’échanger avec l’un de nos experts ? Besoin d’en savoir plus ?
En savoir plus

Recevez notre newsletter

La protection des données nous tient à cœur. JAG utilise les informations que vous fournissez afin de vous proposer des informations et du contenu pertinent sur nos produits et services. Vous pouvez vous désinscrire de ce type de communications à tout moment. Pour plus d'informations, consultez notre politique de confidentialité
© 2022 JAG Consulting, sas. Tous droits réservés.
© 2022 JAG Consulting, sas. Tous droits réservés.
4.8
Lire les 51 avis
google
Brieuc Pauly
08/09/2022

Créative, dynamique et très professionnelle, c'est à mon sens les piliers qui soutiennent cette équipe talentueuse ! Une agence à taille humaine qui privilégie la qualité et le résultat. Alors si vous souhaitez le meilleur pour votre communication adressez vous les yeux fermés à ces passionnés, plus que compétents ! (Translated by Google) Creative, dynamic and very professional, these are in my opinion the pillars that support this talented team! A human-sized agency that favors quality and results. So if you want the best for your communication, turn your eyes closed to these enthusiasts, who are more than competent!

google
Amaury Tardier
08/09/2022

Merci à Julien et son équipe, plus que satisfait par le travail fourni ! Je recommande vivement ! (Translated by Google) Thanks to Julien and his team, more than satisfied with the work provided! I highly recommend !

Ravi de travailler avec l'équipe JAG pour la gestion de mon site de e-Commerce. Equipe réactive et toujours pleine de bonnes idées pour améliorer les performances du site (Translated by Google) Glad to work with the JAG team for the management of my e-Commerce site. Responsive team always full of good ideas to improve the performance of the site

Merci à Julien pour son accompagnement dans mon projet, je recommande à 200% c est le Top (Translated by Google) Thanks to Julien for his support in my project, I recommend 200% it is the top

Excellente agence. Equipe est très pro, à l'écoute et de bon conseils. (Translated by Google) Excellent agency. The team is very professional, attentive and gives good advice.

Temps de réponse hors pair quand il y a eu un pb sur mon site, je vous recommande chaleureusement Julien :-) (Translated by Google) Unparalleled response time when there was a problem on my site, I warmly recommend Julien :-)

Charger plus
listarrow-right
Julien

Julien

Votre conseiller

I will be back soon

Une question ?

Julien
Bonjour ! Je suis Julien.
Comment puis-je vous aider?
Démarrer la conversation:
chat Live Chat