- Creatively Nino
- Nov 14, 2020
- 1 min read
Want to know in-depth details on how you can spice up your blog by using Wix pro gallery on your website using Wix Code a.k.a. Corvid??
Here is the helpful code to get you going! Let me know if you need any more assistance in the comments on YouTube or contact me at the bottom today!
📚 WHAT WAS COVERED:
Add Wix Pro Gallery
Edit/Manage Wix Pro Gallery Layout, Design, and Settings
Create and Code Blog Items into the Wix Pro Gallery
Save and Preview Results in Preview Mode
Code Snippet to follow along with the video:
Page Code
This imports the multiple API's
import wixData from 'wix-data';
import wixLocation from 'wix-location';
This loads the page code
$w.onReady(function () {
// TODO: write your page related code here...
updateGallery()
});
Get updateGallery function and call for the latest post a query
function updateGallery () {
wixData.query("Blog/Posts").descending("lastPublishedDate").find().then(async (res) => {
if (res) {
let info = [];
res.items.map(async (elem) => {
if (elem["coverImageDisplayed"]) {
info.push({ "type": "image", "src": elem["coverImage"], "alt": elem["title"], "title": elem["title"], "description": elem["excerpt"], "link": elem["postPageUrl"] })
}
})
$w("#gallery1").clickAction = "link";
$w("#gallery1").items = await info.slice(0, 5);
} else {
$w("#gallery1").collapse()
}
})
}
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
📺 MY PLAYLISTS :
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
💻 WEBSITE
Check out more of the website. If you have a question, let's chat it up below! More information coming soon so stay tuned!
Comments