I was able to add a frontend “Delete” link to my posts by adding this code to entry.php:
<?php if ( current_user_can( 'edit_post', get_the_id() ) ) : ?> | <a onclick="return confirm('Are you SURE you want to delete this post?')" href="<?php echo ( get_delete_post_link( get_the_id() ) ); ?>" class="delete-post-link" rel="<?php the_ID(); ?>"><?php _e( 'Delete', 'p2' ); ?></a> <?php endif; ?>
<?php do_action( 'p2_action_links' ); ?>
But when this executes, it refreshed the entire page. Does anyone know how I might tell P2 to use the same sort of Ajax script to delete a post, as it does to create them?
- The topic ‘P2 Frontend delete with Ajax?’ is closed to new replies.