Make WordPress Core

Ticket #16478: 16478-3.patch

File 16478-3.patch, 2.0 KB (added by aubreypwd, 10 years ago)

Moved Get Shortlink to get_sample_permalink_html

  • wp-admin/edit-form-advanced.php

     
    447447<div class="inside">
    448448<?php
    449449$sample_permalink_html = $post_type_object->public ? get_sample_permalink_html($post->ID) : '';
    450 $shortlink = wp_get_shortlink($post->ID, 'post');
    451 $permalink = get_permalink( $post->ID );
    452 if ( !empty( $shortlink ) && $shortlink !== $permalink && $permalink !== home_url('?page_id=' . $post->ID) )
    453     $sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr($shortlink) . '" /><a href="#" class="button button-small" onclick="prompt(&#39;URL:&#39;, jQuery(\'#shortlink\').val()); return false;">' . __('Get Shortlink') . '</a>';
    454450
    455451if ( $post_type_object->public && ! ( 'pending' == get_post_status( $post ) && !current_user_can( $post_type_object->cap->publish_posts ) ) ) {
    456452        $has_sample_permalink = $sample_permalink_html && 'auto-draft' != $post->post_status;
    457453?>
    458454        <div id="edit-slug-box" class="hide-if-no-js">
     455
    459456        <?php
    460457                if ( $has_sample_permalink )
    461458                        echo $sample_permalink_html;
  • wp-admin/includes/post.php

     
    11271127        if ( isset($view_post) )
    11281128                $return .= "<span id='view-post-btn'><a href='$view_link' class='button button-small'>$view_post</a></span>\n";
    11291129
     1130        $shortlink = wp_get_shortlink($post->ID, 'post');
     1131       
     1132        if ( !empty( $shortlink ) && $shortlink !== $permalink && $permalink !== home_url('?page_id=' . $post->ID) ){
     1133                $return .= '<input id="shortlink" type="hidden" value="' . esc_attr($shortlink) . '" /><a href="#" class="button button-small" onclick="prompt(&#39;URL:&#39;, jQuery(\'#shortlink\').val()); return false;">' . __('Get Shortlink') . '</a>';
     1134        }
     1135
    11301136        $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);
    11311137
    11321138        return $return;