I want to open different lightboxes for the different blog/posts so I've written this little code to the post page code, but it didn't work:
import wixWindow from 'wix-window';
import wixData from 'wix-data';
$w.onReady(function () {
if (wixData("#Title") === "Awards Season predictions") {wixWindow.openLightbox("LBEmlak1");}
if (wixData("#Title") === "College season kicks off") {wixWindow.openLightbox("LBEmlak2");}
});
Hi! It is possible to do what you are asking to do using the post page API. This API allows you to get the data of the post that is now presented on the screen.
e.g.,
$w('#post1').getPost().then((post)=>{let postTitle = post.title;if(postTitle ==="anytext"){// write some code that does something}}).catch((error)=>{
console.log(error);});
Please let me know if my example helped and if you have any further questions :)
Yes it works, Thank you. But when the site first loaded and click on forexample "Awards Season predictions" from the Home page (https://mediacat.wixsite.com/yeninesilemlak) the lightbox doesn't work for the first time. It work only the second time you click on it. How can I solve this problem. There are two lightboxes: "Awards Season predictions" and "College season kicks off"
Well I would like to be able to manipulate how many likes a post has once I post it to encourage real people to read/engage with the post. So being able to set a custom starting number for how many likes a post has. Wix already let’s you do this with their website hit counter.
@neelwolf8 So this thing requires some coding skills. Soon we will publish a step by step guide on how to do cool things with a few lines of code. Stay tuned :)
I agree!!!! This needs to be done ASAP!!!!
Thank you for sharing your needs. I'm adding your request to the features Wishlist.
Can you please give me couple examples in which cases you might need to use import and how editing in the collection could help you out?
I want to open different lightboxes for the different blog/posts so I've written this little code to the post page code, but it didn't work:
import wixWindow from 'wix-window'; import wixData from 'wix-data'; $w.onReady(function () { if (wixData("#Title") === "Awards Season predictions") {wixWindow.openLightbox("LBEmlak1");} if (wixData("#Title") === "College season kicks off") {wixWindow.openLightbox("LBEmlak2");} });
@gaye_haracci
Hi! It is possible to do what you are asking to do using the post page API. This API allows you to get the data of the post that is now presented on the screen.
e.g.,
Please let me know if my example helped and if you have any further questions :)
Yes it works, Thank you. But when the site first loaded and click on forexample "Awards Season predictions" from the Home page (https://mediacat.wixsite.com/yeninesilemlak) the lightbox doesn't work for the first time. It work only the second time you click on it. How can I solve this problem. There are two lightboxes: "Awards Season predictions" and "College season kicks off"
Well I would like to be able to manipulate how many likes a post has once I post it to encourage real people to read/engage with the post. So being able to set a custom starting number for how many likes a post has. Wix already let’s you do this with their website hit counter.
Hi, thanks for contacting us :)
You can build your own liking system if you want, using a new collection and the post page API. Would you like me to explain how to do it?
@Maya Ekron O my god, yes, please!!! :)
But please keep in mind that I do not know anything about code lol.
@neelwolf8 So this thing requires some coding skills. Soon we will publish a step by step guide on how to do cool things with a few lines of code. Stay tuned :)