Noptin_Form::get_html()

Returns the html required to display the form


Return Return

(string) html


Top ↑

Source Source

File: includes/class-noptin-form.php

	public function get_html() {
		$type       = esc_attr( $this->optinType );
		$id         = $this->id;
		$id_class   = "noptin-form-id-$id";
		$type_class = "noptin-$type-main-wrapper";

		if ( 'popup' !== $type ) {

			$count = (int) get_post_meta( $id, '_noptin_form_views', true );
			update_post_meta( $id, '_noptin_form_views', $count + 1 );

		}

		$html = "<div class='$type_class $id_class noptin-optin-main-wrapper'>";

		if ( 'popup' === $type ) {
			$html .= "<div class='noptin-popup-optin-inner-wrapper'>";
		}

		// Maybe print custom css.
		if ( ! empty( $this->CSS ) ) {

			// Our best attempt at scoping styles.
			$wrapper = '.noptin-optin-form-wrapper';
			$css     = str_ireplace( ".$type_class", ".$type_class.$id_class", $this->CSS );
			$css     = str_ireplace( $wrapper, ".$id_class $wrapper", $css );
			$html   .= "<style>$css</style>";
		}

		$html .= $this->_get_html();

		if ( 'popup' === $type ) {
			$html .= '</div>';
		}

		// print main form html.
		$html = do_shortcode( $html . '</div>' );

		// Remove comments.
		$html = preg_replace( '/<!--(.*)-->/Uis', '', $html );

		return apply_filters( 'noptin_optin_form_html', $html, $this );
	}


Top ↑

User Contributed Notes User Contributed Notes

30 day money back guarantee
Safe & Secure online payment
Custom CSS Slide Example
Custom Animation Example
Default Animation