Call the template page where you want to place tinyMCE , on this template page put a placeholder , for example CONTENT_EDITOR , and use the php str_replace function to add tinyMCE to this template content
function add_tinymce_to_page(){ $creatorHTML = file_get_contents( 'your-template-pafe.php', TRUE ); $editorHTML = generate_content_with_editor(); $creatorHTML = str_replace( 'CONTENT_EDITOR', $editorHTML, $creatorHTML ); return $creatorHTML; } function generate_content_with_editor(){ ob_start(); wp_editor( '', 'tinymcecontenteditor' ); $editor_contents = ob_get_contents(); ob_get_clean(); return $editor_contents; }
I am using php ob , so tinyMCE not displayed until the full page is displayed.
source share