Last active
December 22, 2015 01:28
-
-
Save eccentricpixel/6396304 to your computer and use it in GitHub Desktop.
Setup a loop in php to get your array of values and then echo those values inside of backstretch or other js functions. Below is an example of using PODS to pull a marquee image from a CPT created with Pods. While you can use php directly inside your script tag, the js functionality will not work properly; for instance, in the case of Backstretc…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$counter = 0; | |
$marqueesParams = array('limit'=> 20); | |
$marquees = pods('marquee'); | |
$marquees->find($marqueesParams); | |
if (0 < $marquees->total()){ | |
while ($marquees->fetch()) { | |
$artwork = $item->field('marquee_artwork'); | |
foreach($artwork as $art) { | |
$artwork_js .= "\"".$art['guid']."\", "; | |
} | |
} | |
} | |
?> | |
<script>jQuery(document).ready(function($){ | |
$.backstretch([<?=$artwork_js?>], {duration: 13000, fade: 750}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment