Skip to content

Latest commit

 

History

History
53 lines (34 loc) · 1.37 KB

README.md

File metadata and controls

53 lines (34 loc) · 1.37 KB

Sane HTML Newsletters (working title)

Description

Convert any page generated by WordPress into HTML with inline styles to be used in newsletters.

Installation

  1. Clone the repo
  2. run composer install from freshly cloned plugin root
  3. Activate the plugin
  4. Add a filter with path to your newsletter css (defaults to current theme's style.css)
  5. Create newsletter template (see e.g. below)
  6. Enjoy your sanity while dealing with HTML newsletters

Example

All you need to do is to start your template file with ob_start(); and end it with echo Sane_HTML_Newsletters::convert( ob_get_clean() );

ob_start();

// Regular WP template goes here

echo Sane_HTML_Newsletters::convert( ob_get_clean() );

Alternatively, you can use shnl_should_auto_convert filter to determine whether current request's output should be autoconverted

add_filter( 'shnl_should_auto_convert', function( $should_convert ) {
	if ( is_page( 'my-newsletter-page' ) )
		return true;

	return $should_convert;
} );

Use a filter to specify path to desired CSS file:

add_filter( 'shnl_stylesheet_path', function( $css_file_path ) { return 'my/absolute/path/to/newsletter.css' } );

Todo

Developers

Miss a feature? Pull requests are welcome.

Props

Tijs Verkoyen for his CssToInlineStyles class.