Skip to content

Instantly share code, notes, and snippets.

@asathoor
Created March 14, 2023 09:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asathoor/f76eceddfa5c7a09e505a64a9b090955 to your computer and use it in GitHub Desktop.
Save asathoor/f76eceddfa5c7a09e505a64a9b090955 to your computer and use it in GitHub Desktop.
WordPress and JSON working sample from Int. Class
<!-- 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