/** * [edit_tag_link] shortcode * Uses output buffering to avoid rewriting a bunch of code in comments_number() which can only be echo'd * * @since 0.1 * @author Ryan Hellyer <*****@*****.**> * @return string */ public function edit_tag_link_shortcode($atts) { // Grabbing parameters and setting default values extract(shortcode_atts(array('text' => 'Edit post'), $atts)); // Sanitization of edit text $text = sanitize_title($text); ob_start(); edit_tag_link($text); $edit_tag = ob_get_contents(); ob_end_clean(); return $edit_tag; }
/** * Display an edit link if "current_user_can" for current object * * @param $type * @param null $id * @param string $text * @param string $before * @param string $after */ function edit_link_if_so($type, $id = null, $text = 'Edit', $before = '<i class="fa fa-pencil-square fa-fw"></i> ', $after = '') { if (!get_basicbootstrap_mod('show_edit_links')) { return; } $text = __($text, 'basicbootstrap'); ob_start(); if ($type == 'tag') { edit_tag_link($text, '', '', $id); } elseif ($type == 'category') { edit_category_link($text, '', '', $id); } else { edit_post_link($text); } $ctt = ob_get_contents(); ob_end_clean(); if (!empty($ctt)) { echo $before . $ctt . $after; } }