Widget:UPMakingADifference: Difference between revisions
Appearance
No edit summary |
No edit summary |
||
| (6 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
<includeonly> | <includeonly> | ||
<div class="update-news"> | <div class="update-news update-making-difference"> | ||
<div class="update-online-loading"> | <div class="update-online-loading"> | ||
| Line 21: | Line 20: | ||
<div class="update-online-date"></div> | <div class="update-online-date"></div> | ||
<h2 class="update-online-title"></h2> | <h2 class="update-online-title" style="color: #000000 !important;"></h2> | ||
<div class="update-online-excerpt"></div> | <div class="update-online-excerpt"></div> | ||
| Line 177: | 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 = 'block'; | |||
}) | |||
/* | |||
* 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> | |||
Latest revision as of 07:03, 26 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}}