Created
March 14, 2023 09:19
-
-
Save asathoor/f76eceddfa5c7a09e505a64a9b090955 to your computer and use it in GitHub Desktop.
WordPress and JSON working sample from Int. Class
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
<!-- wp:image {"align":"center","id":968,"sizeSlug":"full","linkDestination":"none"} --> | |
<figure class="wp-block-image aligncenter size-full"><img src="https://thoth.dk/wp-content/uploads/2023/03/image-4.png" alt="" class="wp-image-968"/><figcaption class="wp-element-caption">Orange Amps Unlimited</figcaption></figure> | |
<!-- /wp:image --> | |
<!-- wp:heading --> | |
<h2>Orange Amps Unlimited</h2> | |
<!-- /wp:heading --> | |
<!-- wp:paragraph --> | |
<p>From New Orleans playing woodoo rock on old style instruments From New Orleans playing woodoo rock on old style instruments From New Orleans playing woodoo rock on old style instruments From New Orleans playing woodoo rock on old style instruments </p> | |
<!-- /wp:paragraph --> | |
<!-- wp:paragraph --> | |
<p>Stage: Orange</p> | |
<!-- /wp:paragraph --> | |
<!-- wp:html --> | |
<div id="result"></div> | |
<script> | |
let bands = { | |
"List": [ | |
{ | |
"Band": "The Kinks", | |
"Stage": "Blue", | |
"Image": "https://thoth.dk/wp-content/uploads/2023/03/image-4.png" | |
}, | |
{ | |
"Band": "Velvet Underground", | |
"Stage": "Orange", | |
"Image": "https://thoth.dk/wp-content/uploads/2023/03/punk.jpeg" | |
}, | |
{ | |
"Band": "Aura", | |
"Stage": "Green", | |
"Image": "https://thoth.dk/wp-content/uploads/2023/03/image-3.png" | |
}, | |
{ | |
"Band": "Ozzy Osborne", | |
"Stage": "Black", | |
"Image": "https://thoth.dk/wp-content/uploads/2023/03/manga-band.jpeg" | |
}, | |
{ | |
"Band": "Mozart Rock Experience", | |
"Stage": "Pink", | |
"Image": "https://thoth.dk/wp-content/uploads/2023/03/manga-band.jpeg" | |
}, | |
{ | |
"Band": "Sigurds Ulvetime", | |
"Stage": "Blue", | |
"Image": "https://thoth.dk/wp-content/uploads/2023/03/manga-band.jpeg" | |
}, | |
{ | |
"Band": "Pink Floyd", | |
"Stage": "Orange", | |
"Image": "https://thoth.dk/wp-content/uploads/2023/03/manga-band.jpeg" | |
} | |
] | |
} | |
for ( let i = 0; i<bands.List.length; i++ ){ | |
result.innerHTML += "<div>" | |
result.innerHTML += "<img src='" + bands.List[i].Image + "'class='respImg' alt='Band image'>" | |
result.innerHTML += bands.List[i].Band + "<br>" | |
result.innerHTML += "</div>" | |
} | |
</script> | |
<!-- /wp:html --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment