|   |   |   | ||||
| Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. | 
|    | 
| 
 | |||||||
| Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. | 
|  | Thread Tools | 
|  03-29-2010, 01:19 PM | #1 | 
| (felis madjewicus) Industry Role:  Join Date: Jul 2006 Location: In Mom & Dad's Basement 
					Posts: 20,368
				 | 
				
				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. | 
|   |           | 
|  03-29-2010, 01:30 PM | #2 | 
| Confirmed User Industry Role:  Join Date: Jul 2009 
					Posts: 217
				 | |
|   |           | 
|  03-29-2010, 02:48 PM | #3 | 
| Confirmed User Industry Role:  Join Date: Aug 2008 Location: Hollywood 
					Posts: 2,785
				 | |
|   |           | 
|  03-29-2010, 03:25 PM | #4 | |
| I help you SUCCEED Industry Role:  Join Date: Nov 2003 Location: The Pearl of the Orient Seas 
					Posts: 32,195
				 | Quote:  | |
|   |           | 
|  03-29-2010, 04:36 PM | #5 | 
| Confirmed User Industry Role:  Join Date: Aug 2008 Location: Hollywood 
					Posts: 2,785
				 | |
|   |           | 
|  03-30-2010, 11:37 AM | #6 | 
| (felis madjewicus) Industry Role:  Join Date: Jul 2006 Location: In Mom & Dad's Basement 
					Posts: 20,368
				 | 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 | 
|   |           | 
|  03-30-2010, 12:20 PM | #7 | |
| Too lazy to set a custom title Industry Role:  Join Date: Aug 2002 
					Posts: 55,372
				 | Quote: 
 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&post=" . $post->ID, 'delete-post_' . $post->ID) . "'>".$link."</a>";
	echo $before . $link . $after;
}Code: <?php wp_delete_post_link('Delete This', '<p>', '</p>');?> 
				__________________ Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.  WP Stuff | |
|   |           | 
|  04-01-2010, 09:45 AM | #10 | 
| Confirmed User Industry Role:  Join Date: Oct 2001 Location: Toronto 
					Posts: 7,103
				 | I don't know if he does, but I can use it. Thanks, Fris. | 
|   |           | 
|  04-01-2010, 10:37 AM | #11 | 
| Too lazy to set a custom title Industry Role:  Join Date: Aug 2002 
					Posts: 55,372
				 | 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); 
				__________________ Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.  WP Stuff | 
|   |           | 
|  04-01-2010, 10:57 AM | #12 | 
| (felis madjewicus) Industry Role:  Join Date: Jul 2006 Location: In Mom & Dad's Basement 
					Posts: 20,368
				 | 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. | 
|   |           | 
|  04-01-2010, 02:07 PM | #13 | 
| (felis madjewicus) Industry Role:  Join Date: Jul 2006 Location: In Mom & Dad's Basement 
					Posts: 20,368
				 | works great, i really need to learn how to work with the functions more | 
|   |           |