Function Reference: geodir_edit_post_link
Summary
Outputs the edit post link.
Description
Outputs the edit post link if the current logged in user owns the post.
Global Values
- $preview
- (bool) (required) True if the current page is add listing preview page. False if not.
- Default: None
- $post
- (WP_Post|null) (required) The current post, if available.
- Default: None
Package
GeoDirectory
Change Log
Since: 1.0.0
Actions
‘geodir_before_edit_post_link’ [Line: 468]
‘geodir_after_edit_post_link’ [Line: 489]
Filters
‘geodir_edit_post_link_html’ [Line: 499]
Source File
geodir_edit_post_link() is located in geodirectory_hooks_actions.php [Line: 459]
Source Code
function geodir_edit_post_link()
{
global $post, $preview;
ob_start(); // Start buffering;
/**
* This is called before the edit post link html in the function geodir_edit_post_link()
*
* @since 1.0.0
*/
do_action('geodir_before_edit_post_link');
if (!$preview) {
$is_current_user_owner = geodir_listing_belong_to_current_user();
if ($is_current_user_owner) {
$post_id = $post->ID;
if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
$post_id = (int)$_REQUEST['pid'];
}
$postlink = get_permalink(geodir_add_listing_page_id());
$editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
echo ' ';
}
}// end of if, if its a preview or not
/**
* This is called after the edit post link html in the function geodir_edit_post_link()
*
* @since 1.0.0
*/
do_action('geodir_after_edit_post_link');
$content_html = ob_get_clean();
if (trim($content_html) != '')
$content_html = '';
if ((int)get_option('geodir_disable_user_links_section') != 1) {
/**
* Filter the geodir_edit_post_link() function content.
*
* @param string $content_html The output html of the geodir_edit_post_link() function.
*/
echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html);
}
}