WordPress.org

Ready to get started?Download WordPress

Forums

Post Expirator
Always On and Default Date/Time Duration for +7 days. (9 posts)

  1. pauce
    Member
    Posted 1 year ago #

    Can someone help please.
    Q1. Is it possible to set the plugin to be always on for every post?
    Q2. I'm wanting to set the Default Date/Time Duration: to be + 7 days after the publish time/date. What value do I use in the custom?

    http://wordpress.org/extend/plugins/post-expirator/

  2. pauce
    Member
    Posted 1 year ago #

    Need to re-write Q2
    Q2. I'm wanting to set the "Default Date/Time Duration" to be 7 days after the publish time/date of the post. What value do I use in the custom field?

  3. ynk
    Member
    Posted 1 year ago #

    I have the same question as Pauce. Please update me of how to set duration to custom post to expire after 7 days

  4. Aaron Axelsen
    Member
    Plugin Author

    Posted 1 year ago #

    Q1. I will consider this for the future, but its not currently possible.
    Q2. You can use the "Default Date/Time Duration" option. Set it to custom, and then enter "+7 days". This will prepopulate the expiration date boxes.

  5. feshin
    Member
    Posted 1 year ago #

    I'd also be interested in being able to set the expiration to be always on for a post.

  6. Handoko
    Member
    Posted 1 year ago #

    By editing post-expirator/post-expirator.php, I'm able to make it default always on for new posts/pages.

    1. Go to menu > Plugins > Editor
    2. Select plugin to edit: Post Expirator
    3. Go to line no. 222 and 223 (inside function expirationdate_meta_box)
    4. Change line 222 to $enabled = ' checked="checked"';
    5. Change line 223 to $disabled = '';
    6. Save it by clicking Update File button

    The simple trick above will make all new posts/pages default on for expire time given. But the best is to wait Aaron to implement always on/off feature.

  7. Handoko
    Member
    Posted 1 year ago #

    === Updated ===

    The previous trick above will always enable expire for new or saved posts/pages. I modified to the code to only enable expire for new posts/pages by using get_post_status($post->ID) == 'auto-draft'.

    1. Go to menu > Plugins > Editor
    2. Select plugin to edit: Post Expirator
    3. Go to line 222 and 223 (inside function expirationdate_meta_box)
    4. Delete line 222 and 223 and add this:

    $enabled = '';
    $disabled = ' disabled="disabled"';
    if (get_post_status($post->ID) == 'auto-draft') {
    $enabled = ' checked="checked"';
    $disabled = '';
    }

    Save it by clicking Update File button.

  8. qzha017
    Member
    Posted 1 year ago #

    Hi Handoko Zhang I did what you described above but nothing happened

    }

    $enabled = '';
    $disabled = ' disabled="disabled"';
    if (get_post_status($post->ID) == 'auto-draft') {
    $enabled = ' checked="checked"';
    $disabled = '';
    }

    can you please help me set up an default expiration time of say 10 days from publishing?
    is there a function I can put in the loop?

  9. Handoko
    Member
    Posted 1 year ago #

    @qzha017:

    Sorry for the late reply, I don't get any notification from this forum website.

    My trick may not working correctly now because the plugin has been updated by the developer. The good news is it's already able to use default expiration on for all new posts/pages.

    It's also had configuration to use post/page publish time, but I doubt it will working as what we expect to be.

    I suggest you to create a new support topic, if what you mean is not working if the date is based on the publish time.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.