Make WordPress Core

Ticket #12702: wp_12702_meta-boxes_mgw_030916.diff

File wp_12702_meta-boxes_mgw_030916.diff, 2.2 KB (added by MrGregWaugh, 9 years ago)

Use post_type_supports( 'sticky') to enable this functionality

  • htdocs/wp-admin/includes/meta-boxes.php

    diff --git a/htdocs/wp-admin/includes/meta-boxes.php b/htdocs/wp-admin/includes/meta-boxes.php
    index 1627b1f..193dab7 100644
    a b if ( 'private' == $post->post_status ) { 
    134185} elseif ( !empty( $post->post_password ) ) {
    135186        $visibility = 'password';
    136187        $visibility_trans = __('Password protected');
    137 } elseif ( $post_type == 'post' && is_sticky( $post->ID ) ) {
     188} elseif ( ($post_type == 'post' || post_type_supports( $post_type, 'sticky' )) && is_sticky( $post->ID ) ) {
    138189        $visibility = 'public';
    139190        $visibility_trans = __('Public, Sticky');
    140191} else {
    echo esc_html( $visibility_trans ); ?></span> 
    148199
    149200<div id="post-visibility-select" class="hide-if-js">
    150201<input type="hidden" name="hidden_post_password" id="hidden-post-password" value="<?php echo esc_attr($post->post_password); ?>" />
    151 <?php if ($post_type == 'post'): ?>
     202<?php if ($post_type == 'post' || post_type_supports( $post_type, 'sticky' )): ?>
    152203<input type="checkbox" style="display:none" name="hidden_post_sticky" id="hidden-post-sticky" value="sticky" <?php checked(is_sticky($post->ID)); ?> />
    153204<?php endif; ?>
    154205<input type="hidden" name="hidden_post_visibility" id="hidden-post-visibility" value="<?php echo esc_attr( $visibility ); ?>" />
    155206<input type="radio" name="visibility" id="visibility-radio-public" value="public" <?php checked( $visibility, 'public' ); ?> /> <label for="visibility-radio-public" class="selectit"><?php _e('Public'); ?></label><br />
    156 <?php if ( $post_type == 'post' && current_user_can( 'edit_others_posts' ) ) : ?>
     207<?php if ( ($post_type == 'post' || post_type_supports( $post_type, 'sticky' ) ) && current_user_can( 'edit_others_posts' ) ) : ?>
    157208<span id="sticky-span"><input id="sticky" name="sticky" type="checkbox" value="sticky" <?php checked( is_sticky( $post->ID ) ); ?> /> <label for="sticky" class="selectit"><?php _e( 'Stick this post to the front page' ); ?></label><br /></span>
    158209<?php endif; ?>
    159210<input type="radio" name="visibility" id="visibility-radio-password" value="password" <?php checked( $visibility, 'password' ); ?> /> <label for="visibility-radio-password" class="selectit"><?php _e('Password protected'); ?></label><br />