Help with post_edit_link() arguments (2 posts)

  1. BCPower
    Posted 6 years ago #

    In the following line from index.php, I added a few non-breaking spaces to the $after argument to add some pseudo-padding when logged in as an admin or other contributor.

    How can I add and IMAGE to the $before argument? I want to add a preceding icon but ONLY when logged in as an admin or other contributor.

    <?php edit_post_link('Edit', '', '&nbsp;&nbsp;&nbsp;'); ?>

  2. esmi
    Forum Moderator
    Posted 6 years ago #

    You could use something like:

    <?php if(  is_user_logged_in() ) echo '<span class="edit_logged_in">';?>
    <?php edit_post_link('edit', '', ''); ?>
    <?php if(  is_user_logged_in() ) </span>

    then in your stylesheet:

    .post-edit-link a {
    .edit_logged_in .post-edit-link a {
    background:url(images/icon.gif) left center no-repeat;

    [ assuming a 16 x 16 icon in your theme's images folder ]

Topic Closed

This topic has been closed to new replies.

About this Topic