這是我第一次使用wp_enqueue_script作爲我嘗試在WordPress網站上設置的IDX解決方案。我的文件路徑是兒童主題/ JS/idx.jswp_enqueue_script不顯示腳本
我把這個代碼在我functions.php文件:
<?php
function wptuts_scripts_with_jquery()
{
// Register the script like this for a theme:
wp_register_script('custom-script', get_template_directory_uri() . '/js/idx.js', array('jquery'));
// For either a plugin or a theme, you can then enqueue the script:
wp_enqueue_script('custom-script');
}
add_action('wp_enqueue_scripts', 'wptuts_scripts_with_jquery'); ?>
這個代碼我idx.js文件:
<script src="http://ajax.microsoft.com/ajax/jquery/jquery-1.3.2.min.js" type="text/javascript" ></script>
<script src="http://tools.example.com/scripts/postmessage.min.js" type="text/javascript" ></script>
<script type="text/javascript" >
$.createDynamicFrame('http://example.example.com', 'http://example.example.com/26611/Carets/search?parentUrl=' + encodeURIComponent(document.location.href), 'MapSearch');
這什麼都不做。當我在其他腳本的functions.php中使用wptuts_scripts_with_jquery()函數時,它似乎可以工作,但不會與idx.js腳本一起工作。任何幫助將非常感激。
謝謝!