web-dev-qa-db-fra.com

Essayer d'intégrer le formulaire de campagne Zoho

Le plug-in Zoho Campaigns ne fonctionne donc pas et pose des problèmes avec Slider Revolution.

J'ai abandonné le plug-in et obtenu le code de Zoho Campaign. Il doit être intégré et le code d'en-tête de zoho ressemble à ceci

<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>

J'ai mis à jour functions.php dans le thème de mon enfant avec

  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);

Mais quelle est la bonne façon de faire cela dans l'en-tête

<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

Vous pouvez ajouter du code JavaScript intégré à l'aide de l'action wp_head de la manière suivante:

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;
}

Vous devrez cependant échapper correctement à vos chaînes pour que cela fonctionne.

1
Tdelang