Last active
September 21, 2024 21:01
-
-
Save randalio/d227ddbee4979eeeb12f765608305e53 to your computer and use it in GitHub Desktop.
Import text as Paragraph Block using WP All Import
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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