Advertisement
firoze

wp-feedburner-email subscribe

Oct 28th, 2015
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.51 KB | None | 0 0
  1. <?php
  2.  
  3. // call this code in functions.php
  4.  
  5. // Feed burner Email Subscriber Widget Development
  6.  
  7. class cb_email_subscribes extends WP_Widget {
  8. public function __construct() {
  9. parent::__construct('cb_email_subscribes', 'Email Subscriber', array(
  10. 'description' => 'This is Email Subscriber Widget for google feedburner service',
  11. ));
  12.  
  13. }
  14. public function widget($args, $instance){
  15. if($instance['title']) {
  16. $title = $instance['title'];
  17. }
  18. else {
  19. $title = 'Email Subscribe';
  20. }
  21. if($instance['email_sub_url']){
  22. $email_sub_url = $instance['email_sub_url'];
  23. }
  24. else {
  25. $email_sub_url = 'onlinesolve';
  26.  
  27. }
  28. $email_sub_form = '<div class="sidebar-email-subscribe-area">
  29. <form action="https://feedburner.google.com/fb/a/mailverify" method="post" target="popupwindow" onsubmit="window.open(\'https://feedburner.google.com/fb/a/mailverify?uri='.$email_sub_url.'\', \'popupwindow\', \'scrollbars=yes,width=550,height=520\');return true">
  30. <p>
  31. <input class="email-subscribe" placeholder="Enter your email address:" type="email" name="email"/>
  32. <input type="hidden" value="'.$email_sub_url.'" name="uri"/><input type="hidden" name="loc" value="en_US"/><input class="email-subscribe-submit" type="submit" value="Subscribe" />
  33. </p>
  34. </form>
  35. <p class="sidebar-email-sub-total">
  36. <a href="http://feeds.feedburner.com/'.$email_sub_url.'"><img src="http://feeds.feedburner.com/~fc/'.$email_sub_url.'?bg=99CCFF&amp;fg=444444&amp;anim=1" height="26" width="88" style="border:0" alt="" /></a>
  37. </p>
  38. </div>';
  39. $cb_email_widget_content = $args['before_title'].$title.$args['after_title'];
  40. $cb_email_widget_content .= $email_sub_form;
  41.  
  42. echo $args['before_widget'].$cb_email_widget_content.$args['after_widget'];
  43.  
  44. }
  45. public function form($instance){
  46. if($instance['title']) {
  47. $title = $instance['title'];
  48. }
  49. else {
  50. $title = 'Email Subscribe';
  51. }
  52. if($instance['email_sub_url']){
  53. $email_sub_url = $instance['email_sub_url'];
  54. }
  55. else {
  56. $email_sub_url = 'onlinesolve';
  57.  
  58. }
  59.  
  60. ?>
  61. <p>
  62. <label for="<?php echo $this->get_field_id('title');?>">Title:</label>
  63. <input class="widefat" id="<?php echo $this->get_field_id('title');?>" name="<?php echo $this->get_field_name('title');?>" type="text" value="<?php echo $title; ?>"/>
  64. </p>
  65. <p>
  66. <label for="<?php echo $this->get_field_id('email_sub_url');?>">Feed Address:</label>
  67. <br/>
  68. <span class="cb_feed_sub_text">Copy and paste your Feedburner feed here.</span>
  69. <input class="widefat" id="<?php echo $this->get_field_id('email_sub_url');?>" name="<?php echo $this->get_field_name('email_sub_url');?>" type="text" value="<?php echo $email_sub_url; ?>"/>
  70. <p></p>
  71. <span class="cb_feed_sub_text">Example: <strong>onlinesolve</strong> <br/> for <a target="_blank" href="http://feeds.feedburner.com/onlinesolve">http://feeds.feedburner.com/onlinesolve</a> feed address.<br/>If you don't have feed url then go to <a href="http://feeds.feedburner.com/" target="_blank">Feedburner</a> and signup</span>
  72. </p>
  73. <?php
  74. }
  75.  
  76. public function update($new_instance, $old_instance ){
  77. $instance = $old_instance;
  78.  
  79.  
  80. $instance['title'] = $new_instance['title'];
  81. $instance['email_sub_url'] = $new_instance['email_sub_url'];
  82. return $instance;
  83.  
  84. }
  85.  
  86. }
  87. function cb_email_sub_function() {
  88. register_widget('cb_email_subscribes');
  89. }
  90.  
  91. add_action('widgets_init', 'cb_email_sub_function');
  92.  
  93.  
  94.  
  95. function cb_email_sub_function_style(){
  96. ?>
  97. <style type="text/css">
  98. /*--------------------------------------------------------
  99. Sidebar Email Subscribes
  100. ---------------------------------------------------------*/
  101. .sidebar-email-subscribe-area{}
  102. .sidebar-email-subscribe-area form {text-align: center; padding: 3px;margin-bottom: 10px}
  103. input.email-subscribe {border: 1px solid #ddd;
  104. border-radius: 5px;
  105. float: left;
  106. margin-bottom: 5px;
  107. padding: 6px;
  108. width: 65% !important;
  109. }
  110. input.email-subscribe-submit {background: none repeat scroll 0 0 #ddd !important;
  111. border: 1px solid #ddd !important;
  112. border-radius: 5px;
  113. color: #333 !important;
  114. float: left;
  115. font-size: 14px !important;
  116. margin-left: 6px;
  117. margin-top: 0;
  118. padding: 5px !important;cursor: pointer;}
  119. .sidebar-email-sub-total{float: right;
  120. margin-top: 5px;}
  121. .sidebar-email-sub-total a{}
  122. .sidebar-email-sub-total a img{}
  123.  
  124.  
  125.  
  126. </style>
  127. <?php
  128.  
  129. }
  130. add_action('wp_head', 'cb_email_sub_function_style');
  131. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement