WordPress tables with tinymce

If you want to build tables within wordpress there are two options

  • use tinmce advanced with table tools
  • use a plugin

Using a plugin is the option I have chosen, and among many available plugins I have chosen websimon tables because it is quite simple, comes with custom styles including alternate row colors. The only thing is that editable fields are not wysiwyg, which is easily implemented via two basic code modifications that we detail here

in edit_table.php, call the wp_editor function instead of displaying textarea fields :

$settings = array( 'media_buttons' => false , "editor_height"=>100,"textarea_rows"=>2, "width"=>"200","textarea_name"=>'cell' . $cell_counter );
wp_editor( stripslashes($cell[$col_counter-1]),"idcell" . $cell_counter,$settings);

 

and in shortcode.php, you need to specify a call to the content filter in order to add necessary p and br tags. Job Done !

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *