WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] [PLUGIN: Post Expirator] Custom Post Type, Custom Status (2 posts)

  1. tzeldin88
    Member
    Posted 4 years ago #

    The Post Expirator plugin is amazing! I made two modifications though, so I want to share in case others have the same needs.

    The plugin works on Posts and Pages, but can also work on a Custom Post Type.
    Edit your post-expirator.php, adding:

    // for custom post type "report"
    function expirationdate_meta_report() {
    	add_meta_box('expirationdatediv', __('Post Expirator'), 'expirationdate_meta_box', 'report', 'advanced', 'high');
    }
    add_action ('dbx_post_advanced','expirationdate_meta_report');

    My wp also has custom post statuses, thanks to a combination of the Edit Flow plugin, and the new built-in support in wp3.0 for register_post_status. So when a post expires, I am changing its status to "Archived" instead of "Draft" or "Trash". I edited post-expirator.php, changing a few instances of
    $expiredStatus = 'draft';
    to
    $expiredStatus = 'archived';
    I also tried adding an option for "archived" to the admin ui dropdown, which correctly set the option in the database to "archived" but that wasn't enough, there was some php that must have ignored it.

    Hope this helps someone.

  2. sputnick3k
    Member
    Posted 3 years ago #

    I would only mention 2 things for this post:

    1) You have to give it the name of the custom post type. Where is says 'report'

    2) You can actually just add it to you functions.php file. That way you don't have to worry about it getting erased when you have to upgrade the plugin in the future.

Topic Closed

This topic has been closed to new replies.

About this Topic