Widget:UPMakingADifference: Difference between revisions
Appearance
No edit summary |
No edit summary |
||
| Line 176: | Line 176: | ||
media.source_url | media.source_url | ||
) { | ) { | ||
imageUrl = media | imageUrl = media.source_url; | ||
} else if ( | |||
sizes.medium && | |||
sizes.medium.source_url | |||
) { | |||
imageUrl = sizes.medium.source_url; | |||
} | |||
} | |||
/* | |||
* DISPLAY IMAGE | |||
*/ | |||
if (imageUrl) { | |||
image.src = imageUrl; | |||
image.alt = post.title.rendered | |||
.replace(/<[^>]*>/g, ''); | |||
image.style.display = 'block'; | |||
image.onerror = function () { | |||
console.error( | |||
'Unable to load Making a Difference image:', | |||
imageUrl | |||
); | |||
image.style.display = 'none'; | |||
}; | |||
} | |||
/* | |||
* SHOW CONTENT | |||
*/ | |||
loading.style.display = 'none'; | |||
content.style.display = 'flex'; | |||
}) | |||
/* | |||
* ERROR HANDLING | |||
*/ | |||
.catch(function (error) { | |||
console.error( | |||
'Making a Difference Widget:', | |||
error | |||
); | |||
loading.textContent = | |||
'Unable to load the latest Making a Difference article.'; | |||
}); | |||
})(); | |||
</script> | |||
</includeonly> | |||
<noinclude> | |||
== UP Making a Difference Widget == | |||
Displays the latest article from the UP website's | |||
Making a Difference category, including its featured | |||
image, publication date, excerpt, and article link. | |||
=== Usage === | |||
<pre> | |||
{{#widget:UPMakingADifference}} | |||
</pre> | |||
</noinclude> | |||
Revision as of 00:06, 23 October 2026
UP Making a Difference Widget
Displays the latest article from the UP website's Making a Difference category, including its featured image, publication date, excerpt, and article link.
Usage
{{#widget:UPMakingADifference}}