Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dynamically generated Wordpress Wysiwyg Editor ( wp_editor ) not displaying properly

I have 2 html wysiwyg editors on a wordpress admin page. Both use WP_EDITOR() function. The first one is hard coded into the page:

<form name="form1" id="form1" method="post" action="" style="display:block;">
  <p>
    <!-- editor here -->
    <?php
       wp_editor( 'CONTENT WILL APPEAR HERE!', 'addsometxt', array('textarea_name'=>'create_txt','textarea_rows'=>10,'wpautop'=>false));
    ?>
  </p>
  <p>
   <input name="save" type="submit" class="button-primary" id="save" style="margin:5px;" value="Save Input" /></p>
</form>

The second one is generated dynamically with a PHP function using an AJAX call (wp_ajax_ and $.post). I've test the ajax call and know it works; so, for brevity, here's the php function:

<?php
function display_editor2() {
// grab data from database (data_from_db) and display in editor
  wp_editor( $row->data_from_db, 'editsometxt', array('textarea_name'=>'edit_txt','textarea_rows'=>10,'wpautop'=>false));

} 
?>

The problem is that even though the 2nd editor is displaying; it's missing all the tool bar buttons. See image below for illustration. Anyone know who to fix this?

enter image description here

like image 939
C King Avatar asked Jul 31 '13 22:07

C King


1 Answers

I had the same problem.

When I add the code <?php wp_footer(); ?> in my footer.php, it works.

like image 91
yeeloving Avatar answered Oct 04 '22 12:10

yeeloving