• Hello there. I was wondering if it’d be possible to override es_cls_widget in functions.php. Something like:

    // Override email-subscribers/classes/es-loadwidget.php
    class es_cls_widget_ext extends es_cls_widget {
    	public static function load_subscription($arr) {
    		$es_name = trim($arr['es_name']);
    		$es_desc = trim($arr['es_desc']);
    		$es_group = trim($arr['es_group']);
    		$url = "'" . home_url() . "'";
    		$es = "";
    
    		global $es_includes;
    		if (!isset($es_includes) || $es_includes !== true) {
    			$es_includes = true;
    		}
    
    		$es .= '<div class="newsletter">';
    		$es .= '<form class="es_shortcode_form" data-es_form_id="es_shortcode_form">';
    
    		if( $es_desc != "" ) {
    			$es .= '<div class="es_caption">'.$es_desc.'</div>';
    		}
    		if( $es_name == "YES" ) {
    			$es .= '<div class="es_lablebox"><label class="es_shortcode_form_name">'.__( 'Name', ES_TDOMAIN ).'</label></div>';
    			$es .= '<div class="es_textbox">';
    				$es .= '<input type="text" id="es_txt_name_pg" class="es_textbox_class" name="es_txt_name_pg" value="" maxlength="225">';
    			$es .= '</div>';
    		}
    		$es .= '<div class="es_lablebox"><label class="es_shortcode_form_email">'.__( 'Subscribe to our Newsletter', ES_TDOMAIN ).'</label></div>';
    		$es .= '<div class="es_textbox">';
    			$es .= '<input type="text" id="es_txt_email_pg" class="es_textbox_class" name="es_txt_email_pg" placeholder="Email Address" onkeypress="if(event.keyCode==13) es_submit_pages(event, '.$url.')" value="" maxlength="225">';
    		$es .= '</div>';
    		$es .= '<div class="es_button">';
    			$es .= '<input type="button" id="es_txt_button_pg" class="es_textbox_button es_submit_button" name="es_txt_button_pg" onClick="return es_submit_pages(event, '.$url.')" value="'.__( 'OK', ES_TDOMAIN ).'">';
    		$es .= '</div>';
    		$es .= '<div class="es_msg" id="es_shortcode_msg"><span id="es_msg_pg"></span></div>';
    		if( $es_name != "YES" ) {
    			$es .= '<input type="hidden" id="es_txt_name_pg" name="es_txt_name_pg" value="">';
    		}
    		$es .= '<input type="hidden" id="es_txt_group_pg" name="es_txt_group_pg" value="'.$es_group.'">';
    
    		$es .= '</form>';
    		$es .= '</div>';
    		return $es;
    	}
    }

    Any help would be appreciated.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Icegram

    (@icegram)

    @garl ,

    Can you let me know why you want to override it?

    Sorry about hijacking the discussion. I’d at least like to have the widget configurable so that I could choose between text in label or placeholder, and have the text configurable rather than hardcoded to “Email *”. My second wish is to have the widget consistent with search in e.g. Twenty Sixteen theme (<label><span class="screen-reader-text">...</span><input type="email" ...></label><button type="submit" class="subscribe-submit"><span class="screen-reader-text">...</span></button> rather than each inside a <div/>) so that input and button could be displayed inline.

    +1

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Override Widget Function’ is closed to new replies.