WordPress.org

Make WordPress Core

Ticket #24675: re-synic.patch

File re-synic.patch, 2.5 KB (added by pbearne, 6 years ago)

patch to add resyinc button

  • wp-admin/includes/post.php

     
    11031103        $return =  '<strong>' . __('Permalink:') . "</strong>\n";
    11041104        $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
    11051105        $return .= '&lrm;'; // Fix bi-directional text display defect in RTL languages.
    1106         $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
     1106        $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a>\n";
     1107        $return .= '<a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="syncPermalink(' . $id . '); return false;">' . __('Re-Sync') . "</a></span>\n";
     1108       
    11071109        $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";
    11081110        if ( isset($view_post) )
    11091111                $return .= "<span id='view-post-btn'><a href='$view_link' class='button button-small'>$view_post</a></span>\n";
  • wp-admin/js/post.js

     
    1 var tagBox, commentsBox, editPermalink, makeSlugeditClickable, WPSetThumbnailHTML, WPSetThumbnailID, WPRemoveThumbnail, wptitlehint;
     1var tagBox, commentsBox, editPermalink, syncPermalink, makeSlugeditClickable, WPSetThumbnailHTML, WPSetThumbnailID, WPRemoveThumbnail, wptitlehint;
    22
    33// return an array with any duplicate, whitespace or values removed
    44function array_unique_noempty(a) {
     
    681681
    682682        // permalink
    683683        if ( $('#edit-slug-box').length ) {
     684
     685                syncPermalink = function(post_id) {
     686
     687                        $.post(ajaxurl, {
     688                                        action: 'sample-permalink',
     689                                        post_id: post_id,
     690                                        new_slug: $('#title').val(),
     691                                        new_title: $('#title').val(),
     692                                        samplepermalinknonce: $('#samplepermalinknonce').val()
     693                                }, function(data) {
     694                                        var box = $('#edit-slug-box');
     695                                        box.html(data);
     696                                        makeSlugeditClickable();
     697                                        $('#view-post-btn').show();
     698                                });
     699                }
     700
    684701                editPermalink = function(post_id) {
    685702                        var i, c = 0, e = $('#editable-post-name'), revert_e = e.html(), real_slug = $('#post_name'), revert_slug = real_slug.val(), b = $('#edit-slug-buttons'), revert_b = b.html(), full = $('#editable-post-name-full').html();
    686703