post_type;
$post_type_object = get_post_type_object( $post_type );
$can_publish = current_user_can( $post_type_object->cap->publish_posts );
return $can_publish
// Choose your post types
&& in_array( $post->post_type, array( 'page', 'event' ) );
}
// Start deferring php output
add_action( 'post_submitbox_minor_actions', 'w_post_submitbox_minor_actions' );
function w_post_submitbox_minor_actions( $post ) {
if ( need_sticky( $post ) ) {
ob_start();
}
}
// Get PHP output and print sticky posts metabox
add_action( 'post_submitbox_misc_actions', 'w_post_submitbox_misc_actions' );
function w_post_submitbox_misc_actions( $post ) {
if ( need_sticky( $post ) ) {
$temp = ob_get_clean();
// WP core need two different checkbox: on for authors, and another one for editors
$sticky_box = 'ID ), true, false ) . ' />';
if ( current_user_can( 'edit_others_posts' ) ) {
$sticky_box .= sprintf( '
',
checked( is_sticky( $post->ID ), true, false ),
__( 'Stick this post to the front page' ) );
}
$re = '/(