/**
  * load custom CSS & JS
  */
 public static function load_custom_js_css()
 {
     global $post;
     if (!isset($post) || 'landing-page' != $post->post_type) {
         return;
     }
     $custom_css_name = Landing_Pages_Variations::prepare_input_id('lp-custom-css');
     $custom_js_name = Landing_Pages_Variations::prepare_input_id('lp-custom-js');
     $custom_css = Landing_Pages_Variations::get_custom_css($post->ID);
     $custom_js = Landing_Pages_Variations::get_custom_js($post->ID);
     echo "<!-- This site landing page was built with the WordPress Landing Pages plugin - https://www.inboundnow.com/landing-pages/ -->";
     if (!stristr($custom_css, '<style')) {
         echo '<style type="text/css" id="lp_css_custom">' . $custom_css . '</style>';
     } else {
         echo $custom_css;
     }
     if (!stristr($custom_js, '<script')) {
         echo '<script type="text/javascript" id="lp_js_custom">jQuery(document).ready(function($) {
     ' . $custom_js . ' });</script>';
     } else {
         echo $custom_js;
     }
 }
示例#2
0
 /**
  * Display custom JS metabox
  */
 public static function display_custom_js_metabox()
 {
     global $post;
     $custom_js_name = Landing_Pages_Variations::prepare_input_id('lp-custom-js');
     $custom_js = Landing_Pages_Variations::get_custom_js($post->ID);
     echo '<textarea name="' . $custom_js_name . '" id="lp_custom_js" rows="5" cols="30" style="width:100%;">' . $custom_js . '</textarea>';
 }