Skip to main content

How To Hide A Row, Section or Column When No ACF Value?

Introduction

Follow this step to hide a row, section or column when there is no ACF value.

Watch This Video

Step 1: Add JavaScript

If you would like to hide a row, section or column when there is no ACF value available, add this JavaScript code to Divi Machine > Machine Settings > Custom JS.

<script> 
jQuery(document).ready(function ($) { // fires when jQuery is ready

hidethis();

$( document ).ajaxComplete(function() { // after ajax filter complete
hidethis();
});

function hidethis(){
$('.et_pb_de_mach_acf_item.hidethis').each(function(i, obj) { // For each ACF Item that has no value
$(this).closest(".et_pb_row").addClass("hidethis"); // Looks for closest row and then adds class
});
}
});
</script>