web-dev-qa-db-ja.com

Zohoキャンペーンフォームを統合しようとしています

そのため、Zoho Campaignsプラグインは機能せず、Slider Revolutionに問題を引き起こします。

私はプラグインを捨てて、Zoho Campaignからコードを入手しました。統合する必要があり、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>

私は私の子供のテーマでfunctions.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
techpad

次のようにwp_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;
}

これを機能させるには、文字列を適切にエスケープする必要があります。

1
Tdelang