• Resolved Paul Whitener Jr.

    (@pwhitene)


    I’m looking for a way to hide the post date for particular posts. For example, I have a “sticky post” on my index page that I don’t want to display the date for. I would like the other posts on the page to show the date.

    Is there a way to set whether to show/hide the date on a post-by-post basis, or a way to hide the date on sticky posts only?

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • buddha-trance

    (@buddha-trance)

    I just tested this and it worked.

    On index.php, you will see something like
    <?php the_time('M jS, Y'); ?>

    Just use this, so that when the post is sticky, it won’t display

    <?php if (!is_sticky() ) { ?>
    <?php the_time('M jS, Y'); ?>
    <?php }
    ?>
    Thread Starter Paul Whitener Jr.

    (@pwhitene)

    Nice, that worked perfectly. Thanks!

    Thanks pwhitene, this is exactly what I was looking for. I’ve implemented and it works! Thanks a whole bunch.

    https://www.citygeisha.com

    Great work – it works perfectly on our basic, but modified Kubrick theme.

    Andy

    Tilman

    (@archeryimagesnet)

    Thanks! In my case, I wanted to erase all the things that are published by the theme if the post is sticky.
    So I set the if(!is_sticky()) around the <p> tag. So

    <p class="timestamp"><?php the_time('j F, Y (H:i)') ?> | <?php the_category(', ') ?> | By: <?php the_author(); ?><?php edit_post_link('[e]',' | ',''); ?></p>

    became:

    <?php if (!is_sticky() ) { ?>
    <p class="timestamp"><?php the_time('j F, Y (H:i)') ?> | <?php the_category(', ') ?> | By: <?php the_author(); ?><?php edit_post_link('[e]',' | ',''); ?></p>
    <?php } ?>

    Just for the search engine Visitors.. ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Hide post date for single post?’ is closed to new replies.