首页 > 解决方案 > 如何在 WordPress (API) 中设置一些 JavaScript

问题描述

我有这个代码,但我无法让它在我的 WordPress 中工作,我已经使用了插件Insert Headers & Footers,而且WP Coder......但我不确定它为什么不起作用,页面只是空白。

我怎样才能让它工作?我应该在 WordPress 网站的什么位置放置 - 插件等?

我试图把它放在“HTML 代码”下的“WP CODER”中:

但它不起作用,页面是空白的。

1)将以下代码添加到<head>您网站的部分:

<link rel="stylesheet" type="text/css"href="<a href="https://zellr.com/integration/kirpparikalle.css" rel="nofollow noreferrer">https://zellr.com/integration/kirpparikalle.css" />

2)将以下代码添加到页面的部分。将它放在您希望查看登录和注册表单的元素中。

<h1 id="kirpparikalle_title"></h1>
<br/>
<div id="kirpparikalle_container"></div>
<!-- Note: jQuery is requirement for the integration scripts.
If you already have jQuery included in your website, you can remove the next line. -->
<script type="text/javascript" ```src="https://zellr.com/integration/jquery.min.js"></script>
<script type="text/javascript" ```src=”https://zellr.com/integration/kirpparikalle_i18n.js"></script>
<script type="text/javascript">
$(function() {
KK_COMPANY = ' denlillelandsoldat '; 
KK_CONFIG['redirect_url'] = 'http://denlillelandsoldat.dk/';
KK_LANGUAGE = 'da';
kk_show_default_login();
});
</script>

它应该在页面上显示一些预订模块。

标签: javascriptwordpressapi

解决方案


尝试复制此确切代码并将其粘贴到您希望它出现的位置,您在网站上应用的代码中有奇怪的字符。此外,js 代码可能会产生错误以对包装器进行一些更改

<link rel="stylesheet" type="text/css" href="https://zellr.com/integration/kirpparikalle.css" />
<div id="kirpparikalle_container"></div>
<!-- Note: jQuery is requirement for the integration scripts.
If you already have jQuery included in your website, you can remove the next line. -->
<script type="text/javascript" src="https://zellr.com/integration/jquery.min.js"></script>
<script type="text/javascript" src="https://zellr.com/integration/kirpparikalle_i18n.js"></script>
<script type="text/javascript">
(function($) {
    $(function() {
    KK_COMPANY = ' denlillelandsoldat '; 
    KK_CONFIG['redirect_url'] = 'http://denlillelandsoldat.dk/';
    KK_LANGUAGE = 'da';
    kk_show_default_login();
})( jQuery );
</script>

推荐阅读