Related Posts Hack to Keep Old Posts From Showing Up (2 posts)

  1. missadventures
    Posted 6 years ago #

    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.


  2. MichaelH
    Posted 6 years ago #

    In a loop, where the posts' custom field status is outdated don't do relatedpost template:

    $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...

Topic Closed

This topic has been closed to new replies.

About this Topic