Viewing 3 replies - 1 through 3 (of 3 total)
  • As the gif is a background image assigned through css to the post title’s <h2> tag, you’ll have to attack this in two places.

    1. Modify your theme’s style.css, changing h2.pen to h2.pen1, and adding a new class declaration:

    h2.pen2 {
    margin-bottom: 1px;
    margin-left: 0px;
    padding: 6px 2px 2px 24px;
    background: url(images/pen2.gif) no-repeat 0px 4px;
    }

    2. At the start of The Loop in your theme’s template(s), you’ll want to insert this bit of PHP:

    <?php
    if('private' == $post->post_status) {
    $pen = 'pen2';
    } else {
    $pen = 'pen1';
    } ?>

    You also need to alter the opening <h2> tag, so it’s:

    <h2 class="<?php echo $pen; ?>" id="post-<?php the_ID(); ?>">

    Note on forum posting: please don’t post the same question multiple times. If you’re new to WordPress and the forums, this Codex page is recommended:

    https://codex.www.ads-software.com/Using_the_Support_Forums

    Thread Starter NullMind

    (@nullmind)

    thanks

    it all works great for the main page, but when you go to “archives” the pen icon disapeered all togueder .. am I missing somehting ?

    Thread Starter NullMind

    (@nullmind)

    oops, I got it

    had to do the same exact thign for archive.php as I did for index.php ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Change icon if Private’ is closed to new replies.