我正在尝试插入这段代码:
<script type="text/javascript">
some Javascript codes comes here
</script>
将代码添加到WordPress前端和管理面板的<head></head>
部分。
例如,Joomla!1.6具有允许此操作的API:
$doc =& JFactory::getDocument();
$doc->addCustomTag($headTag);
我需要为不同的页面添加不同的内容。例如:
第一页,我需要添加
<link rel="alternate" type="application/rss+xml" title="feed title" href="feed url" />
对于几个页面
第二页 我需要添加
<script type=\"text/javascript\" src=\"" . LIVE_SITE .
"/wp-content/plugins/jobs/lknlibrary/js/ajax.js\"></script>
<script type=\"text/javascript\">
var ajax = new sack();
var currentClientID=false;
function getClientData()
{
var clientId = document.getElementById('db_country_id').value.replace(/[^0-9]/g,'');
ajax.requestFile = '" .BASE_PATH . "/wp-content/plugins/jobs/com_jobs_admin/tasks/get_location_data.php?task=get_location_data&name=db_parent_id&getClientId='+clientId; // Specifying which file to get
ajax.onCompletion = showClientData; // Specify function that will be executed after file has been found
ajax.runAJAX(); // Execute AJAX function
}
function showClientData()
{
clearJS = ajax.response;
var strTagStrippedText = clearJS.replace(/(<\s*\/?\s*)div(\s*([^>]*)?\s*>)/gi ,'');
document.getElementById('locationsDiv').innerHTML=strTagStrippedText ;
}
function initFormEvents()
{
if (document.getElementById('db_country_id')){
document.getElementById('db_country_id').onchange = getClientData;
document.getElementById('db_country_id').focus();
}
}
window.onload = initFormEvents;
</script>
对于几个页面
第三页 我需要添加
<link rel="stylesheet" type="text/css" href="/wordpress/wp-content/plugins/jobs/lknlibrary/js/tabs/tab.webfx.css" />
有几个页面
我在管理面板中有70多个像上面那样的页面。
尝试使用示例来管理WordPress的页眉有点困难。