I want uses to be able to edit posts on my site by clicking a link that displays an ajax form within a modal window (using [[LINK href="http://foundation.zurb.com"]]Zurb's Foundation framework[[/LINK]]).
The form should allow the title, content, category and tags to be edited. If the title and/or content fields are left empty, there should be a message underneath the relevant field prompting the user to enter a value before the form can be submitted.
***
The link that triggers the modal window should be a function that I could place within my theme.
Also, the form is meant for a custom post type ("community") and custom taxonomies ("community_categories" and "community_tags").
The finished work can be provided as a plugin or raw code I will integrate into my theme's function file.
That's it. Please let me know if you have any questions.
<strong>EDIT:
</strong>
I need to be able to place the edit button within a loop so that it will allow me to choose from one of multiple entries to edit. Also, I don't want a solution that depends on a plugin (unless it could be easily integrated into a theme or a large plugin I'm working on).
Romel Apuya answers:
there is a simple tutorial [[LINK href="https://www.flynsarmy.com/2013/03/edit-wordpress-posts-from-the-front-end/"]]here[[/LINK]]
i cna help with implementing it on your theme
Reigel Gallarde answers:
You could also try this...
download and activate this plugin... [[LINK href="https://wordpress.org/plugins/wp-user-frontend/"]]wp user frontend[[/LINK]]
then add this to your functions.php
add_filter( 'the_content', 'add_ajax_edit_button' );
function add_ajax_edit_button($content){
if (get_post_type() == 'community') {
$content .= '<a href="#" data-reveal-id="myModal">Edit</a>
<div id="myModal" class="reveal-modal large" data-reveal>' . do_shortcode('[wpuf_edit ]') . '</div>';
}
return $content;
}
You could even have a lot of choices other than just the title, content, category and tags. Just visit the settings page of wp user frontend.
Reigel Gallarde comments:
the above code will only work if your theme is built with Zurb's Foundation framework
Reigel Gallarde comments:
Because you did not reply here, here's a [[LINK href="http://printmydesigns.ml/uncategorized/lorem-ipsum-dolor-sit-amet/"]]demo[[/LINK]] using all the defaults but with jquery-ui as modal... it has the same concept as that... to test the demo, you can login using credetials: demo/demo