dimanche 31 janvier 2016

How can I check if I'm on the editor page for Visual Composer?

I need to run a little bit of HTML to run a script in Visual Composer. I'm having a bit of trouble getting this to run through Visual Composer (as I need to run it quite a lot of times so I decided to run it straight in the HTML.

However I only want this piece of code to run when the user is editing a page with Visual Composer.

I tried something like this but it didn't work:

// Check to run scripts
$bodyClass = get_body_class();
if(in_array('vc_editor', $bodyClass)) {
    // Run Script
    $content .= '<script>$(document).ready(function() { generalClass.mainSlider(); });</script>';
}

Any ideas? Is there a is_vc_editor() check that I'm missing?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire