WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Update button for wp_editor on theme front end (3 posts)

  1. francomusso
    Member
    Posted 1 year ago #

    Using the code below, I can very easily get the visual editor to appear on the front end of my theme, displaying the existing content ready to edit. (I love this!)

    <?php
    	$post = get_post($post_id, 'OBJECT');
    	wp_editor(esc_html($post->post_content), 'textarea01'); ?>

    The problem is that I cannot get an Update button to appear in order to submit the changes to the database and actually implement the changes made in the editor.

    I tried adding a submit button using a standard form input and then using submit_button() but this didn't work, resulting in an error on the page.

    Please could someone help me with this? It seems like such an awesome feature to have!!!

  2. sareiodata
    Member
    Posted 1 year ago #

    Check out this introduction to posting from the front-end (you'll need to change it a bit so you can update the current post):
    http://www.cozmoslabs.com/5528-wordpress-post-from-front-end/

    The thing is you need to process the form yourself. This means you'll have to construct the form, add a submit button AND THEN have a function that's hooked into init that will update the post based on the changes in the page:

    To update the post you can use:
    http://codex.wordpress.org/Function_Reference/wp_update_post

  3. francomusso
    Member
    Posted 1 year ago #

    Hi sareiodata, thanks so much for taking the time out to help.
    The article you provided was extremely helpful.
    Altough the functionality isn't as easy to implement as I had anticipated, I think it's definitely worth investing the time for such useful functionality... and the WCK Front End plugin and Creation Kit look fantastic too, by the way :)

Topic Closed

This topic has been closed to new replies.

About this Topic