所以我有一个祈祷时间脚本,我想将它嵌入到 wordpress 页面中。这是它的链接:http: //praytimes.org/manual/
基本上有一个 PrayTimes.js 文件,我试图将其包含到 header.php/page.php 文件中但没有成功。
我将在常规 HTML 页面中发布的代码如下所示:
<!DOCTYPE html>
<html>
<head>
<title> Daily Prayer Timetable </title>
<style>
body, td, th {font-family: verdana; font-size: 12px; color: #404040;}
#timetable {border-width: 1px; border-style: outset; border-collapse: collapse; border-color: gray; width: 9em;}
#timetable td, #timetable th {border-width: 1px; border-spacing: 1px; padding: 2px 4px; border-style: inset; border-color: #CCCCCC;}
#timetable th {color:black; text-align: center; font-weight: bold; background-color: #F8F7F4;}
</style>
</head>
<body>
<script type="text/javascript" src="../PrayTimes.js"></script>
<br>
<p align="center">Waterloo, ON, Canada<p>
<div align="center" id="table"></div>
<script type="text/javascript">
var date = new Date(); // today
var times = prayTimes.getTimes(date, [43, -80], -5);
var list = ['Fajr', 'Sunrise', 'Dhuhr', 'Asr', 'Maghrib', 'Isha', 'Midnight'];
var html = '<table id="timetable">';
html += '<tr><th colspan="2">'+ date.toLocaleDateString()+ '</th></tr>';
for(var i in list) {
html += '<tr><td>'+ list[i]+ '</td>';
html += '<td>'+ times[list[i].toLowerCase()]+ '</td></tr>';
}
html += '</table>';
document.getElementById('table').innerHTML = html;
</script>
</body>
</html>
我只是不确定如何将其嵌入到 Wordpress 页面中。我只需要使用一次。