mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
Slug edit for pages. Hide advanced slug field if JS enabled. Trigger first autosave after 15 chars. Set autosave interval to 60s. Props filosofo. see #5749
git-svn-id: https://develop.svn.wordpress.org/trunk@6955 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -85,8 +85,8 @@ endif; ?>
|
||||
<?php the_editor($post->post_content); ?>
|
||||
<?php wp_nonce_field( 'autosave', 'autosavenonce', false ); ?>
|
||||
<?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
|
||||
<?php wp_nonce_field( 'samplepermalink', 'samplepermalinknonce', false ); ?>
|
||||
<?php wp_nonce_field( 'getpermalink', 'getpermalinknonce', false ); ?>
|
||||
<?php wp_nonce_field( 'samplepermalink', 'samplepermalinknonce', false ); ?>
|
||||
</div>
|
||||
|
||||
<?php echo $form_pingback ?>
|
||||
|
||||
@@ -51,6 +51,12 @@ addLoadEvent(focusit);
|
||||
<h3><?php _e('Title') ?></h3>
|
||||
<div class="inside">
|
||||
<input type="text" name="post_title" size="30" tabindex="1" value="<?php echo attribute_escape( $post->post_title ); ?>" id="title" />
|
||||
<?php $sample_permalink_html = get_sample_permalink_html($post->ID); ?>
|
||||
<div id="edit-slug-box">
|
||||
<?php if ( ! empty($post->ID) && ! empty($sample_permalink_html) ) :
|
||||
echo $sample_permalink_html;
|
||||
endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -60,6 +66,7 @@ addLoadEvent(focusit);
|
||||
<?php wp_nonce_field( 'autosave', 'autosavenonce', false ); ?>
|
||||
<?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
|
||||
<?php wp_nonce_field( 'getpermalink', 'getpermalinknonce', false ); ?>
|
||||
<?php wp_nonce_field( 'samplepermalink', 'samplepermalinknonce', false ); ?>
|
||||
</div>
|
||||
|
||||
<div class="submitbox" id="submitpage">
|
||||
|
||||
@@ -593,7 +593,7 @@ function get_sample_permalink($id, $name = null) {
|
||||
function get_sample_permalink_html($id, $new_slug=null) {
|
||||
$post = &get_post($id);
|
||||
list($permalink, $post_name) = get_sample_permalink($post->ID, $new_slug);
|
||||
if (false === strpos($permalink, '%postname%')) {
|
||||
if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
|
||||
return '';
|
||||
}
|
||||
$title = __('Click to edit this part of the permalink');
|
||||
@@ -603,7 +603,7 @@ function get_sample_permalink_html($id, $new_slug=null) {
|
||||
$post_name_abridged = $post_name;
|
||||
}
|
||||
$post_name_html = '<span id="editable-post-name" title="'.$title.'">'.$post_name_abridged.'</span><span id="editable-post-name-full">'.$post_name.'</span>';
|
||||
$display_link = str_replace('%postname%', $post_name_html, $permalink);
|
||||
$display_link = str_replace(array('%pagename%','%postname%'), $post_name_html, $permalink);
|
||||
$return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink">' . $display_link . "</span>\n";
|
||||
$return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug" onclick="edit_permalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
|
||||
return $return;
|
||||
|
||||
@@ -2,6 +2,9 @@ addLoadEvent( function() {
|
||||
add_postbox_toggles('page');
|
||||
make_slugedit_clickable();
|
||||
|
||||
// hide advanced slug field
|
||||
jQuery('#pageslugdiv').hide();
|
||||
|
||||
jQuery('#timestamp').css('display', 'none');
|
||||
jQuery('.edit-timestamp').click(function () {
|
||||
if (jQuery('#timestamp').is(":hidden")) {
|
||||
|
||||
@@ -68,6 +68,9 @@ addLoadEvent( function() {
|
||||
|
||||
// Editable slugs
|
||||
make_slugedit_clickable();
|
||||
|
||||
// hide advanced slug field
|
||||
jQuery('#slugdiv').hide();
|
||||
|
||||
jQuery('#tags-input').hide();
|
||||
tag_update_quickclicks();
|
||||
|
||||
Reference in New Issue
Block a user