WordPress.org

Ready to get started?Download WordPress

Forums

TablePress
[resolved] Insert table button in wp_editor() (4 posts)

  1. deryck
    Member
    Posted 1 year ago #

    Hi,

    The TablePress plugin enable the insert table button in all page/post/custom-post editor pages. I want to know how I can do that on a wp_editor() generated tinyMCE. I have tried with a lot of parameters and nothing works.

    Help please!

    Thanks in advance.

    http://wordpress.org/extend/plugins/tablepress/

  2. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    thanks for your question.

    That's indeed tricky. I'm not sure what your desired use case for this is, but it should be possible, by executing the add_editor_buttons function from the TablePress admin controller on the page where you are inserting your own editor.

    That should be possible with something like this:

    if ( is_admin() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) )
    	add_action( "load-{$editor_page}", array( TablePress::$controller, 'add_editor_buttons' ) );

    You'll only have to find the correct value for $editor_page. In TablePress, that's either post.php or post-new.php. In your plugin, this is probably the admin menu hook, i.e. the return value of something like add_submenu_page() or add_submenu_page(), depending on how you add your plugin to the WordPress menu.

    Regards,
    Tobias

  3. deryck
    Member
    Posted 1 year ago #

    Thanks a lot Tobias.

    The page is http://localhost:8888/the_project/wp-admin/themes.php?page=options-framework.

    Should be then load-options-framework the $editor_page value?

  4. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    I don't think that it is that easy.
    You should use the return value from add_theme_page() or whatever function you are using there, like

    $editor_page = add_theme_page(...);

    Regards,
    Tobias

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic