Hide OxyExtras navigation arrows based on carousel items

tdrayson

This snippet will hide the navigation arrows on OxyExtras’ Carousel Builder if the contents from the repeater only brings one result.

Since this uses JavaScript, please keep it at the bottom in the structure pane. This will ensure it works as the JS will fire after everything is loaded and after the initial CSS.

Place the code in functions.php or code snippet plugin.

PHP

        <?php

$count = count(get_field("your-repeater-field-name"));

if($count <= 1){
	echo "<script>jQuery('#ID-of-right-arrow,#ID-of-left-arrow').css('display','none');</script>";
}
?>
Copy
Credit to Luke for the snippet

👋🏻 Weekly Tutorial Digest

I send out a weekly newsletter with links to new tutorials written in the last week, you can subscribe below.

Newsletter

🔒I won't send you spam, I promise