Skip to content

Instantly share code, notes, and snippets.

@randalio
Last active September 21, 2024 21:01
Show Gist options
  • Save randalio/d227ddbee4979eeeb12f765608305e53 to your computer and use it in GitHub Desktop.
Save randalio/d227ddbee4979eeeb12f765608305e53 to your computer and use it in GitHub Desktop.
Import text as Paragraph Block using WP All Import
function wpai_import_paragraph_block($paragraph_text){
$output = "";
$output .= '<!-- wp:paragraph \{"placeholder":"'.$paragraph_text.'"\} -->';
$output .= "\n";
$output .= '<p>'.$paragraph_text.'</p>';
$output .= "\n";
$output .= '<!-- /wp:paragraph -->';
return $output;
}
// Usage:
// Within the Content field of the WPAI import template,
// call the function with the data-variable. Example:
// wpai_import_paragraph_block( {paragraph_text[1]} )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment