尝试整合Zoho竞选形式

时间:2016-09-28 作者:techpad

所以Zoho活动插件不起作用,导致滑块革命出现问题。

我放弃了插件,从Zoho活动中获得了代码。它需要集成,zoho的头代码如下所示

<link href="https://campaigns.zoho.com/css/ui.theme.css" rel="stylesheet" type="text/css" />
<link href="https://campaigns.zoho.com/css/ui.datepicker.css" rel="stylesheet" type="text/css" />
<link href="https://campaigns.zoho.com/css/ui.core.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="https://campaigns.zoho.com/js/jquery-1.11.0.min.js"></script>
<script type=\'text/javascript\' src=\'https://campaigns.zoho.com/js/jquery-migrate-1.2.1.min.js\'></script>
<script type="text/javascript" src=\'https://campaigns.zoho.com/js/ui.datepicker.js\'  charset="utf-8"></script>
<script type="text/javascript" src="https://campaigns.zoho.com/js/jquery.form.js"></script>
<script type="text/javascript" src="https://campaigns.zoho.com/js/optin_min.js"></script>
<script type="text/javascript">
var $ZC = jQuery.noConflict();
var trackingText=\'ZCFORMVIEW\';
$ZC(document).ready( function($) {
$ZC("#zc_trackCode").val(trackingText);
    $ZC("#fieldBorder").val($ZC("[changeItem=\'SIGNUP_FORM_FIELD\']").css("border-color"));
    _setOptin(false,function(th){
    /*Before submit, if you want to trigger your event, "include your code here"*/
});

/*Load Captcha For this*/ 
 loadCaptcha(\'https://campaigns.zoho.com/campaigns/CaptchaVerify.zc?mode=generate\');

 /*Tracking Enabled*/ 
 trackSignupEvent(trackingText);
 });
</script>
我已经更新了函数。我的孩子主题中的php

  wp_enqueue_style( \'zstyle1\', \'https://campaigns.zoho.com/css/ui.theme.css"\',false,\'1.1\',\'all\' );
  wp_enqueue_style( \'zstyle2\', \'https://campaigns.zoho.com/css/ui.datepicker.css"\',false,\'1.1\',\'all\' );
  wp_enqueue_style( \'zstyle3\', \'https://campaigns.zoho.com/css/ui.core.css"\',false,\'1.1\',\'all\' );
  wp_enqueue_script( \'zscript1\', \'https://campaigns.zoho.com/js/jquery-1.11.0.min.js\', array ( \'jquery\' ), 1.1, false);
  wp_enqueue_script( \'zscript3\', \'https://campaigns.zoho.com/js/ui.datepicker.js\', array ( \'jquery\' ), 1.1, false);
  wp_enqueue_script( \'zscript4\', \'https://campaigns.zoho.com/js/jquery.form.js\', array ( \'jquery\' ), 1.1, false);
  wp_enqueue_script( \'zscript5\', \'https://campaigns.zoho.com/js/optin_min.js\', array ( \'jquery\' ), 1.1, false);
但是,怎样才能将其放入标题中呢

<script type="text/javascript">
var $ZC = jQuery.noConflict();
var trackingText=\'ZCFORMVIEW\';
$ZC(document).ready( function($) {
$ZC("#zc_trackCode").val(trackingText);
    $ZC("#fieldBorder").val($ZC("[changeItem=\'SIGNUP_FORM_FIELD\']").css("border-color"));
    _setOptin(false,function(th){
    /*Before submit, if you want to trigger your event, "include your code here"*/
});

/*Load Captcha For this*/ 
 loadCaptcha(\'https://campaigns.zoho.com/campaigns/CaptchaVerify.zc?mode=generate\');

 /*Tracking Enabled*/ 
 trackSignupEvent(trackingText);
 });
</script>

1 个回复
最合适的回答,由SO网友:Tdelang 整理而成

您可以使用wp\\u head操作添加内联JavaScript,如下所示:

add_action(\'wp_head\',\'zoho\');

function zoho() {

    $output=\'<script type="text/javascript">
    var $ZC = jQuery.noConflict();
    var trackingText=\'ZCFORMVIEW\';
    $ZC(document).ready( function($) {
        $ZC("#zc_trackCode").val(trackingText);
        $ZC("#fieldBorder").val($ZC([changeItem=\'SIGNUP_FORM_FIELD\']").css("border-color"));
    _setOptin(false,function(th){
    /*Before submit, if you want to trigger your event, "include your code here"*/
});

/*Load Captcha For this*/ 
 loadCaptcha(\'https://campaigns.zoho.com/campaigns/CaptchaVerify.zc?mode=generate\');

 /*Tracking Enabled*/ 
 trackSignupEvent(trackingText);
 });
</script>\';

    echo $output;
}
不过,你必须正确地摆脱你的束缚,才能让这一切顺利进行。