/** * 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; } }
/** * Display custom CSS metabox */ public static function display_custom_css_metabox() { global $post; echo sprintf(__('%sCustom CSS may be required to customize this landing page.%s%s %sFormat%s: #element-id { display:none !important; }%s', 'landing-pages'), '<em>', '</em>', '<strong>', '<u>', '</u>', '</strong>'); $custom_css_name = Landing_Pages_Variations::prepare_input_id('lp-custom-css'); $custom_css = Landing_Pages_Variations::get_custom_css($post->ID); echo '<textarea name="' . $custom_css_name . '" id="lp-custom-css" rows="5" cols="30" style="width:100%;">' . $custom_css . '</textarea>'; }