jeudi 25 août 2016

Random image on refresh in Wordpress

So I'm trying to implement a random image on refresh for a website. However its restricted to using WordPress VC language. It doesn't seem to be accepting the javascript and if it is it isn't able to insert it into the vc code. Note the code cannot include the "[ ]" characters or else it will see it as vc even if its just to create an array inside of the javascript.

<script langauge = "javascript">
var picArray = ("827","829","830");
function getRandomInt(min, max) {
  min = Math.ceil(min);
  max = Math.floor(max);
  return Math.floor(Math.random() * (max - min + 1)) + min;
}
</script>
 [vc_single_image image = "<script>(picArray("/""getRandomInt(827,830)"/"");</script>"] 

Here is a working tidbit of vc image code

[vc_single_image image = "827"]

Any thoughts/ideas?? Thank You!




Aucun commentaire:

Enregistrer un commentaire