WordPress.org

Support

Support » Plugins and Hacks » Related Posts Hack to Keep Old Posts From Showing Up

Related Posts Hack to Keep Old Posts From Showing Up

  • missadventures
    Member

    @missadventures

    Hi there,

    I have searched and searched to see if there is a way to have an expiration date on my posts. But I have not been satisfied with the expiration plugins as they only allow you to delete a post or put it in draft status.

    Some of my outdated posts still get linked to, so I want those visitors to still be able to access info. However, I would like to create a hack of some sort to keep related posts from displaying posts that I deem are “outdated.”

    I know that one way I can do this is with custom fields (key=status and value=outdated, for example). But then I don’t know how to write an “If” statement in either the theme or the related posts plugin to make this happen.

    Any ideas on this would be very appreciated.

    Thanks!
    Melanie

Viewing 1 replies (of 1 total)
  • In a loop, where the posts’ custom field status is outdated don’t do relatedpost template:

    <?php
    $status = get_post_meta($post->ID, 'status', true);
    if ($status != "out_dated" ){
    //do related post template tag here
    }
    ?>

    If you continue this thread, would imagine a link to the download the ‘related posts’ plugin would be necessary…

Viewing 1 replies (of 1 total)
  • The topic ‘Related Posts Hack to Keep Old Posts From Showing Up’ is closed to new replies.