如何将这个jQuery脚本添加到我的Wordpress中

时间:2017-06-26 12:26:26

标签: jquery wordpress

我需要为我的网站加载外部数据,它使用jQuery。好吧,我对jQuery一无所知所以我得到了一个脚本,需要将它粘贴到某个地方以使Wordpress使用它。现在我知道Wordpress是否已经运行了jQuery?我想不是因为我开始空白。

代码:

<script type="text/javascript" src="//code.jquery.com/jquery-1.8.3.min.js"></script>
<link rel="stylesheet" type="text/css" href="//developers.affiliateprogramma.eu/Energievergelijker/style.css">    
<script type="text/javascript" src="//developers.affiliateprogramma.eu/Energievergelijker/general.js"></script> 
<div class="daisyconEnergyComparator" 
    data-daisyconEnergyMediaID="279942" 
    data-daisyconEnergySubID="" 
    data-business="false" 
    data-daisyconEnergyAmount="10" 
    data-daisyconEnergyActionPackets="all"       
    data-daisyconEnergyPackets="all" 
    data-daisyconEnergyCompanies="all" 
    data-daisyconEnergyDuration="all" 
    data-daisyconEnergyDuurzaam="all" 
    data-daisyconEnergyView="all" 
    data-daisyconEnergyUrl="" 
    data-daisyconEnergyShowActionTable="true" 
    data-daisyconEnergyHouse="Appartement" 
    data-daisyconEnergyPersons="Enkel" 
    data-daisyconEnergySave="1" 
    data-daisyconEnergyUrl="" 
    data-daisyconEnergyMeter="enkel" 
    data-daisyconEnergyBaseColor="3498DB" 
    data-daisyconEnergyActionColor="FF8201" >
    <div class="daisyconEnergyFilters"></div>
    <div class="daisyconEnergyTableContainer"></div>
</div>

1 个答案:

答案 0 :(得分:0)

转到function.php并使用wp_enqueue_script()将您的脚本排入队列,其依赖关系为jquery。阅读更多Here