To present the Peace Almanac daily entry on your website as above, and have it update automatically each day, just add the following code to any HTML page. The display will adjust to the width of whatever page or sidebar you include it on, and can be adjusted using CSS.
<script type="text/javascript" src="https://worldbeyondwar.org/js/wbw_peace_almanac.min.js?asdf=jkl"></script><div id="wbw-peace-almanac"></div>
If you have technical questions, please post a comment to this page.
3 Responses
I tried adding the above script to a WordPress sidebar widget, but all that shows up is the script itself. I selected a “code” block for the widget. Any ideas on what I should have done? Thanks!
Alan, please try an HTML widget instead of a code widget. I think a code widget expects PHP code. This is Javascript embedded in HTML (in other words, it’s HTML).
If this doesn’t work, please comment again and we’ll figure it out. Thanks.
Marc
Thanks Marc! In the WordPress editor it works perfectly (after I changed the 6 smartquotes to ascii dumb quotes). At the bottom, the “Today’s full entry” is not a live link, but maybe it isn’t intended to be. However, even though it works fine on preview from the editor, it won’t work from outside the editor when I open our website from the browser (Firefox, up to date I’m pretty sure). Our website was set up about a decade ago and maybe there is some legacy thing that needs to be changed or activated or updated. I should probably holler for help on WordPress. I have the same problem with the counters from nationalpriorities.org. Thanks for your help!