Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Page Generator Pro: Programmatically Process Spintax
* Make sure to run this after WordPress' init hook has completed.
if ( function_exists( 'Page_Generator_Pro' ) ) {
$spin = Page_Generator_Pro()->get_class( 'spintax' )->process( '{Writing|Creating} {content|articles} is {a lot of fun|rewarding experience}.' );
if ( is_wp_error( $spin ) ) {
// Something went wrong e.g. invalid spintax
// Handle this error as you need
echo $spin->get_error_message();
} else {
// Output spun text
echo $spin;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment