WordPress.org

Ready to get started?Download WordPress

Forums

P2
P2 Frontend delete with Ajax? (1 post)

  1. adam98110
    Member
    Posted 6 months ago #

    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; ?>

    right before

    <?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?

    Thanks!
    -Adam

Reply

You must log in to post.

About this Theme

About this Topic