/**
 * 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>&nbsp;', $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;
    }
}
Пример #2
0
    <?php 
get_the_breadcrumb();
?>

    <header class="header">
        <h1 class="entry-title">
            <?php 
the_archive_title();
?>
        </h1>
        <?php 
if (get_basicbootstrap_mod('show_edit_links')) {
    ?>
        <section class="entry-meta blog-post-meta hidden-print">
            <?php 
    edit_category_link(__('Edit', 'basicbootstrap'), '<i class="fa fa-pencil-square fa-fw"></i>&nbsp;', '', get_cat_id(single_cat_title('', false)));
    ?>
        </section>
        <?php 
}
?>
        <?php 
the_archive_description('<div class="category-description lead">', '</div>');
?>
    </header>
    <hr />
    <?php 
get_template_part_hierarchical('partials/loop');
?>

</div>