GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   wordpress question: delete post tag for inclusion in themes? (https://gfy.com/showthread.php?t=960805)

Angry Jew Cat - Banned for Life 03-29-2010 01:19 PM

wordpress question: delete post tag for inclusion in themes?
 
Is there a way I can add a "delete post" right into the theme for when I'm logged in as an admin? So I can edit or delete on the fly while browsing my site? Just a quicklink to jump me right on to the edit screen for that post.

miXXXture 03-29-2010 01:30 PM

http://codex.wordpress.org/Template_Tags/edit_post_link

Robocrop 03-29-2010 02:48 PM

Check this theme out, has exactly what you look for.

http://wordpress.org/extend/themes/p2

$5 submissions 03-29-2010 03:25 PM

Quote:

Originally Posted by Robocrop (Post 16989412)
Check this theme out, has exactly what you look for.

http://wordpress.org/extend/themes/p2

Nice and clean. :thumbsup

Robocrop 03-29-2010 04:36 PM

Quote:

Originally Posted by $5 submissions (Post 16989522)
Nice and clean. :thumbsup

Yup its a cool theme, but I mainly wanted to show the Jew it had the function he was looking for :winkwink:

Angry Jew Cat - Banned for Life 03-30-2010 11:37 AM

checked it out, and added it to my site, thanks guys. would be really slick if i could add a delete post link right on the page to nuke posts as i flip by them, but the edit link works

fris 03-30-2010 12:20 PM

Quote:

Originally Posted by Angry Jew Cat (Post 16989166)
Is there a way I can add a "delete post" right into the theme for when I'm logged in as an admin? So I can edit or delete on the fly while browsing my site? Just a quicklink to jump me right on to the edit screen for that post.

Code:

function wp_delete_post_link($link = 'Delete This', $before = '', $after = '')
{
        global $post;
        if ( $post->post_type == 'page' ) {
                if ( !current_user_can( 'edit_page', $post->ID ) )
                        return;
        } else {
                if ( !current_user_can( 'edit_post', $post->ID ) )
                        return;
        }
        $link = "<a href='" . wp_nonce_url( get_bloginfo('url') . "/wp-admin/post.php?action=delete&amp;post=" . $post->ID, 'delete-post_' . $post->ID) . "'>".$link."</a>";
        echo $before . $link . $after;
}

Code:

<?php wp_delete_post_link('Delete This', '<p>', '</p>');?>
:pimp

fris 03-30-2010 06:41 PM

bump for angry jew

fris 04-01-2010 08:58 AM

still need this?

garce 04-01-2010 09:45 AM

I don't know if he does, but I can use it. Thanks, Fris.

fris 04-01-2010 10:37 AM

you could probably add a bit of ajax, so it reloads the page after delete.

theirs also a function in 2.9+ wp_delete_post() which requires the postid

Code:

global $post;
wp_delete_post($post->ID);

but the other one works for previos versions

Angry Jew Cat - Banned for Life 04-01-2010 10:57 AM

checking this option out now, been working with a shitload of posts every day in wordpress. on the fly deletions should be great. thanks again fris.

Angry Jew Cat - Banned for Life 04-01-2010 02:07 PM

works great, i really need to learn how to work with the functions more


All times are GMT -7. The time now is 09:13 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123