Hi.
I’m looking to add a custom post status, but I want to add it to Listings. For example, posts can be published, draft or trash. I’d like the option to add archive. Ideally, I could set the Expiry Process to set expired posts with the new status.
Here is a bit of code that adds this functionality for native WP posts:
<?php
function jc_custom_post_status(){
register_post_status( 'archive', array(
'label' => _x( 'Archive', 'post' ),
'public' => true,
'show_in_admin_all_list' => false,
'show_in_admin_status_list' => true,
'label_count' => _n_noop( 'Archive <span class="count">(%s)</span>', 'Archive <span class="count">(%s)</span>' )
) );
}
add_action( 'init', 'jc_custom_post_status' );
add_action('admin_footer-post.php', 'jc_append_post_status_list');
function jc_append_post_status_list(){
global $post;
$complete = '';
$label = '';
if($post->post_type == 'post'){
if($post->post_status == 'archive'){
$complete = ' selected="selected"';
$label = '<span id="post-status-display"> Archived</span>';
}
echo '
<script>
jQuery(document).ready(function($){
$("select#post_status").append("<option value="archive" '.$complete.'>Archive</option>");
$(".misc-pub-section label").append("'.$label.'");
});
</script>
';
}
}
?>
Adding the above to the theme’s function.php is supposed to add archives to my post statuses (not sure I did it right, so be wary of using that code).
Can you tell me how I’d change that code to effect ‘gd_places’ instead of ‘posts’, or any other variations that would work on CPTs? Or point me in a better direction to create an archive for expired GD CPTs.