WordPress.org

Forums

Creating an edit page like the one for Posts (9 posts)

  1. kfuchs
    Member
    Posted 2 years ago #

    I am trying to create an edit page for my plugin like the one that is used for editing posts.

    I was wondering is there a class for this like the way WP gives us WP_List_Table to create the tables. Or do we have to create it our selves and just use css to style it?

  2. esmi
    Forum Moderator
    Posted 2 years ago #

  3. kfuchs
    Member
    Posted 2 years ago #

    That was useful but not for this question :). lol

    I have added images to explain it better, here is what I mean, when I click the:

    edit button

    I want this:

    This to appear

    With the proper name and description already in those fields.

  4. Fiaz Husyn
    Member
    Posted 2 years ago #

    Actually there is no such class, however you can implement the editor using wp_editor function.
    check : http://codex.wordpress.org/Function_Reference/wp_editor

  5. kfuchs
    Member
    Posted 2 years ago #

    OMG thank you so much... I googled for HOURS trying to figure it out.

    All the info I encountered were out-dated and referenced functions that didn't exist anymore ;(.

  6. kfuchs
    Member
    Posted 2 years ago #

    tried using it but I keep getting:

    Call to undefined function wp_get_current_user() in ...wordpress\wp-includes\user.php on line 258

  7. Fiaz Husyn
    Member
    Posted 2 years ago #

    This particular error cannot be related to wp_editor function.

    There is some other error in your coding, Just few check before using wp_get_current_user:

    -- Check to see if user is logged in
    -- call current user class: global $current_user; get_currentuserinfo();

    Also see the known issues trac for this particular function: http://core.trac.wordpress.org/ticket/14024

  8. kfuchs
    Member
    Posted 2 years ago #

    I figured out how to solve it, however I do not fully understand how this works.

    when you call wp_editor() it has to be within the function that you use to add_submenu_page()

    IE:

    <?php add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, submenu_page_function); ?>

    <?php function submenu_page_function(){
    wp_editor('<p>Some content</p>', 'editortest_one' );
    }?>

    I did not test but I am assuming it will work in all the
    add_any_page()

    PS: this plugin helped me understand it.

  9. phpzag
    Member
    Posted 2 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags