/** * How to display the widget on the screen. */ function widget($args, $instance) { global $wp_query; $this_id = $wp_query->post->ID; $post = get_post($this_id); $this_type = $wp_query->post->post_type; if ($this_type == 'landing-page') { extract($args); $position = $_SESSION['lp_conversion_area_position']; if ($position == 'widget') { $title = apply_filters('widget_title', $instance['title']); /* Before widget (defined by themes). */ echo $before_widget; /* Display the widget title if one was input (before and after defined by themes). */ if ($title) { echo $before_title . $title . $after_title; } echo "<div id='lp_container' class='inbound-conversion-sidebar'>"; echo do_shortcode(lp_conversion_area($post, $content = null, $return = true, $doshortcode = false)); echo "</div>"; /* After widget (defined by themes). */ echo $after_widget; } } }
function lp_meta_box_conversion_area() { global $post; $meta_box_id = WYSIWYG_META_BOX_ID; $editor_id = WYSIWYG_EDITOR_ID; //Add CSS & jQuery goodness to make this work like the original WYSIWYG echo "\n\t\t\t<style type='text/css'>\n\t\t\t\t\t#{$meta_box_id} #edButtonHTML, #{$meta_box_id} #edButtonPreview {background-color: #F1F1F1; border-color: #DFDFDF #DFDFDF #CCC; color: #999;}\n\t\t\t\t\t#{$editor_id}{width:100%;}\n\t\t\t\t\t#{$meta_box_id} #editorcontainer{background:#fff !important;}\n\t\t\t\t\t#{$meta_box_id} #editor_id_fullscreen{display:none;}\n\t\t\t</style>\n\n\t\t\t<script type='text/javascript'>\n\t\t\t\t\tjQuery(function(\$){\n\t\t\t\t\t\t\t\$('#{$meta_box_id} #editor-toolbar > a').click(function(){\n\t\t\t\t\t\t\t\t\t\$('#{$meta_box_id} #editor-toolbar > a').removeClass('active');\n\t\t\t\t\t\t\t\t\t\$(this).addClass('active');\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\tif(\$('#{$meta_box_id} #edButtonPreview').hasClass('active')){\n\t\t\t\t\t\t\t\t\t\$('#{$meta_box_id} #ed_toolbar').hide();\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\$('#{$meta_box_id} #edButtonPreview').click(function(){\n\t\t\t\t\t\t\t\t\t\$('#{$meta_box_id} #ed_toolbar').hide();\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\$('#{$meta_box_id} #edButtonHTML').click(function(){\n\t\t\t\t\t\t\t\t\t\$('#{$meta_box_id} #ed_toolbar').show();\n\t\t\t\t\t\t\t});\n\n\t\t\t//Tell the uploader to insert content into the correct WYSIWYG editor\n\t\t\t\$('#media-buttons a').bind('click', function(){\n\t\t\t\tvar customEditor = \$(this).parents('#{$meta_box_id}');\n\t\t\t\tif(customEditor.length > 0){\n\t\t\t\t\tedCanvas = document.getElementById('{$editor_id}');\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tedCanvas = document.getElementById('content');\n\t\t\t\t}\n\t\t\t});\n\t\t\t\t\t});\n\t\t\t</script>\n\t"; //Create The Editor $conversion_area = lp_conversion_area(null, null, true, false, false); wp_editor($conversion_area, $editor_id); //Clear The Room! echo "<div style='clear:both; display:block;'></div>"; echo "<div style='width:100%;text-align:right;margin-top:11px;'><div class='lp_tooltip' title=\"" . __('To help track conversions Landing Pages Plugin will automatically add a tracking class to forms. If you would like to track a link add this class to it', 'landing-pages') . " class='wpl-track-me-link'\" ></div></div>"; }
/** * * [lp_conversion_area] shortcode support * */ public static function process_conversion_area_shortcode($atts, $content = null) { extract(shortcode_atts(array('id' => '', 'align' => ''), $atts)); $conversion_area = lp_conversion_area($post = null, $content = null, $return = true, $doshortcode = true, $rebuild_attributes = true); return $conversion_area; }