WordPress.org

Ready to get started?Download WordPress

Forums

Help with post_edit_link() arguments (2 posts)

  1. BCPower
    Member
    Posted 4 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
    Theme Diva & Forum Moderator
    Posted 4 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 {
    display:inline-block;
    padding-right:5px;
    }
    .edit_logged_in .post-edit-link a {
    padding-left:20px;
    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