﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc
14113	Function that could improve the current edit_post_link()	metacortex		"Basicly this function is the same than [http://core.trac.wordpress.org/browser/trunk/wp-includes/link-template.php#L820 edit_post_link()] but some little differences which can make it more useful for developers. So far it has two advantages:

'''1)''' The edit link can be easily returned.

'''2)''' It's possible to choose a class for link tags.

{{{
// Returned
function wp_get_edit_link($args = '') {
	$defaults = array(
		'link'   => null,
		'before' => '',
		'after'  => '',
		'id'     => 0,
		'class'  => 'post-edit-link'
	);

	$r = wp_parse_args($args, $predet);
	extract($r);

	if ( !$post = &get_post($id) )
		return;

	if ( !$url = get_edit_post_link($post->ID) )
		return;

	if (null === $link)
		$link = __('Edit This');

	$post_type_obj = get_post_type_object($post->post_type);
	$link = '<a class=""'. $class .'"" href=""' . $url . '"" title=""' . esc_attr( $post_type_obj->labels->edit_item ) . '"">' . $link . '</a>';
	return $before . apply_filters('get_edit_link' , $link , $post->ID) . $after;
}

// Echoed
function wp_edit_link($args = '') {
	echo wp_get_edit_link($args);
}
}}}

'''Example using the function:'''

Returning:

{{{
<?php 
$var = get_wp_edit_link('before=<span class=""my-edit-class"">&after=</span>&class=my-link-class&link=Edit me!');
echo $var;
?>
}}}

Echoing:

{{{
<?php wp_edit_link('before=<span class=""my-edit-class"">&after=</span>&class=my-link-class&link=Edit me!'); ?>
}}}

Results on:

{{{
<span class=""my-edit-class""><a class=""my-link-class"" href=""http://url.to/post.html"">Edit me!</a></span>
}}}"	enhancement	new	normal	Future Release	Template	3.0	normal		needs-patch	
