Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

WP Email Capture in WP PopUp Scheduler WordPress

  • SOLVED

Hi, I'm using Templatic's Emporium theme and want to know how to insert WP Email Capture within the WP Pop Up Scheduler. Where, what, and how do I insert? (For people to be able to enter their email address directly into the pop up)

Answers (1)

2011-04-18

Hameedullah Khan answers:

There are few changes you will have to make to be able to display WP Email Capture form in WP Popup scheduler.

First add the following in wp-email-capture/wp-email-capture.php on line 27:
function wp_email_capture_in_popup($atts) {
$form = preg_replace("/[\n\r]/", "", wp_email_capture_form_page());
$form = addslashes($form);
return $form;
}


Then add the following in same file on line 46:

add_shortcode('wp_email_capture_popup', 'wp_email_capture_in_popup');

Then insert the following in wp-popup-scheduler/wp-popup-scheduler.php after line 556:

$popup_content = do_shortcode($popup_content);

After making the above changes you can use the following shortcode anywhere in your popup content and the WP Email capture form will be displayed there.

[wp_email_capture_popup]

Hope this helps.


saint merc comments:

where do i add the last part [wp_email_capture_popup]


Hameedullah Khan comments:

I just visited your site and it seems you have placed the last part at the correct place. But it seems like you haven't done the first 3 modifications correctly.


saint merc comments:

This is the first an secound part WHAT PART IS WRONG



<?php

/*

Plugin Name: WP Email Capture

Plugin URI: http://www.gospelrhys.co.uk/plugins/wordpress-plugins/wordpress-email-capture-plugin

Description: Captures email addresses for insertion into software such as <a href="http://www.gospelrhys.co.uk/go/aweber.php" title="Email Marketing">Aweber</a> or <a href="http://www.gospelrhys.co.uk/go/mailchimp.php">Mailchimp</a>

Version: 2.0.1

Author: Rhys Wynne

Author URI: http://www.gospelrhys.co.uk/

*/

global $wp_email_capture_db_version;

$wp_email_capture_db_version = "1.0";

define(WP_EMAIL_CAPTURE_PATH, dirname(__FILE__));

require_once(WP_EMAIL_CAPTURE_PATH . '/inc/core.php');

function wp_email_capture_in_popup($atts) {
$form = preg_replace("/[\n\r]/", "", wp_email_capture_form_page());
$form = addslashes($form);
return $form;
}


if ( is_admin() ){ // admin actions

add_action('admin_menu', 'wp_email_capture_menus');

add_action( 'admin_init', 'wp_email_capture_options_process' );

add_action('wp_dashboard_setup', 'wp_email_capture_add_dashboard_widgets' );

} else {

add_shortcode('wp_email_capture_popup', 'wp_email_capture_in_popup');

add_action('init','wp_email_capture_process');

add_filter ( 'the_content', 'wp_email_capture_display_form_in_post');

}



register_activation_hook(__FILE__,'wp_email_capture_install');



?>


<strong>And this is the 3 part</strong>

function load_WPS_message()
{

$WPS = get_option("WPS_setting");
$display_effect = $WPS['display_style'];
$popup_content ="";
$closetext = '<span style="color:'.$WPS['closetext_color'].'">'.$WPS['close_text'].'</span>';
$popup_title = '<span style="color:'.$WPS['headline_color'].'">'.$WPS['popup_title'].'</span>';
if($display_effect == "lightbox")
{ $popup_content = '<div class="wps_closewin_text"><a href="" onclick="document.getElementById(\\\'WPS_popup_message\\\').style.visibility=\\\'hidden\\\';document.getElementById(\\\'lightbox_div\\\').style.visibility=\\\'hidden\\\';return false;">'.$closetext.'</a></div><div class="wps_headline"><h2 align="'.$WPS['headline_align'].'">'.$popup_title.'</h2></div><div class="wps_body">'.htmlentities($WPS['display_message']).'</div>';
}else
$popup_content = do_shortcode($popup_content);
{ $popup_content = '<div class="wps_closewin_text"><a href="" onclick="document.getElementById(\\\'WPS_popup_message\\\').style.visibility=\\\'hidden\\\';return false;">'.$closetext.'</a></div><div class="wps_headline"><h2 align="'.$WPS['headline_align'].'">'.$popup_title.'</h2></div><div class="wps_body">'.htmlentities($WPS['display_message']).'</div>';
}



<strong>what am i doing wrong</strong>


Hameedullah Khan comments:

The third edit is wrong.

The $popup_content = do_shortcode($popup_content); should come after the else clause like following:


function load_WPS_message()
{

$WPS = get_option("WPS_setting");
$display_effect = $WPS['display_style'];
$popup_content ="";
$closetext = '<span style="color:'.$WPS['closetext_color'].'">'.$WPS['close_text'].'</span>';
$popup_title = '<span style="color:'.$WPS['headline_color'].'">'.$WPS['popup_title'].'</span>';
if($display_effect == "lightbox")
{ $popup_content = '<div class="wps_closewin_text"><a href="" onclick="document.getElementById(\\\'WPS_popup_message\\\').style.visibility=\\\'hidden\\\';document.getElementById(\\\'lightbox_div\\\').style.visibility=\\\'hidden\\\';return false;">'.$closetext.'</a></div><div class="wps_headline"><h2 align="'.$WPS['headline_align'].'">'.$popup_title.'</h2></div><div class="wps_body">'.htmlentities($WPS['display_message']).'</div>';
}else
{ $popup_content = '<div class="wps_closewin_text"><a href="" onclick="document.getElementById(\\\'WPS_popup_message\\\').style.visibility=\\\'hidden\\\';return false;">'.$closetext.'</a></div><div class="wps_headline"><h2 align="'.$WPS['headline_align'].'">'.$popup_title.'</h2></div><div class="wps_body">'.htmlentities($WPS['display_message']).'</div>';
}

$popup_content = do_shortcode($popup_content);