top of page

Hide Sections on Specific Dynamic Pages in Wix

Sometimes you want to showcase certain sections on specific dynamic pages and not others. Well in this lesson, you will learn how to show/hide sections on dynamic pages based on content in the database.


Hide Sections on Dynamic Pages in Wix

Before you get started, check out this video to learn how to properly set it up:



Now that you understand the concept, below is the code used in the video that you can copy over to your site:

 

$w.onReady(function () { $w("#dynamicDataset").onReady(() => { let project = $w("#dynamicDataset").getCurrentItem(); if(project.one===true){ $w("#one").show(); $w("#one").expand(); } else { $w("#one").hide(); $w("#one").collapse(); } if(project.two===true){ $w("#two").show(); $w("#two").expand(); } else { $w("#two").hide(); $w("#two").collapse(); } if(project.three===true){ $w("#three").show(); $w("#three").expand(); } else { $w("#three").hide(); $w("#three").collapse(); } }); });

 

Just copy this code over and make sure the the name of the sections you want to hide match the name given in the editor. Also, make sure that you change ".one" to the field key from the database! Have fun!

bottom of page