Version Description
- Added support for changing post/page slug only
- Fixed incorrect admin edit link
Download this release
Release Info
Developer | michaeltyson |
Plugin | Custom Permalinks |
Version | 0.7.4 |
Comparing to | |
See all releases |
Code changes from version 0.7.3 to 0.7.4
- custom-permalinks.php +17 -6
- readme.txt +7 -5
custom-permalinks.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Custom Permalinks
|
|
4 |
Plugin URI: http://atastypixel.com/blog/wordpress/plugins/custom-permalinks/
|
5 |
Donate link: http://atastypixel.com/blog/wordpress/plugins/custom-permalinks/
|
6 |
Description: Set custom permalinks on a per-post basis
|
7 |
-
Version: 0.7.
|
8 |
Author: Michael Tyson
|
9 |
Author URI: http://atastypixel.com/blog
|
10 |
*/
|
@@ -403,8 +403,8 @@ function custom_permalinks_form($permalink, $original="", $renderContainers=true
|
|
403 |
<?php echo get_home_url() ?>/
|
404 |
<input type="text" class="text" value="<?php echo htmlspecialchars($permalink ? $permalink : $original) ?>"
|
405 |
style="width: 250px; <?php if ( !$permalink ) echo 'color: #ddd;' ?>"
|
406 |
-
onfocus="if ( this.
|
407 |
-
onblur="document.getElementById('custom_permalink').value = this.value; if ( this.value == '' ) { this.value = '<?php echo htmlspecialchars($original) ?>'; this.style.color = '#ddd'; }"/>
|
408 |
<?php if ( $renderContainers ) : ?>
|
409 |
<br />
|
410 |
<small><?php _e('Leave blank to disable', 'custom-permalink') ?></small>
|
@@ -427,8 +427,19 @@ function custom_permalinks_save_post($id) {
|
|
427 |
if ( !isset($_REQUEST['custom_permalinks_edit']) ) return;
|
428 |
|
429 |
delete_post_meta( $id, 'custom_permalink' );
|
430 |
-
if ( $_REQUEST['custom_permalink'] && $_REQUEST['custom_permalink'] != custom_permalinks_original_post_link($id) )
|
431 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
432 |
}
|
433 |
|
434 |
|
@@ -622,7 +633,7 @@ function custom_permalinks_admin_rows() {
|
|
622 |
$row['permalink'] = get_permalink($post->ID);
|
623 |
$row['type'] = ucwords( $post->post_type );
|
624 |
$row['title'] = $post->post_title;
|
625 |
-
$row['editlink'] =
|
626 |
$rows[] = $row;
|
627 |
}
|
628 |
|
4 |
Plugin URI: http://atastypixel.com/blog/wordpress/plugins/custom-permalinks/
|
5 |
Donate link: http://atastypixel.com/blog/wordpress/plugins/custom-permalinks/
|
6 |
Description: Set custom permalinks on a per-post basis
|
7 |
+
Version: 0.7.4
|
8 |
Author: Michael Tyson
|
9 |
Author URI: http://atastypixel.com/blog
|
10 |
*/
|
403 |
<?php echo get_home_url() ?>/
|
404 |
<input type="text" class="text" value="<?php echo htmlspecialchars($permalink ? $permalink : $original) ?>"
|
405 |
style="width: 250px; <?php if ( !$permalink ) echo 'color: #ddd;' ?>"
|
406 |
+
onfocus="if ( this.style.color = '#ddd' ) { this.style.color = '#000'; }"
|
407 |
+
onblur="document.getElementById('custom_permalink').value = this.value; if ( this.value == '' || this.value == '<?php echo htmlspecialchars($original) ?>' ) { this.value = '<?php echo htmlspecialchars($original) ?>'; this.style.color = '#ddd'; }"/>
|
408 |
<?php if ( $renderContainers ) : ?>
|
409 |
<br />
|
410 |
<small><?php _e('Leave blank to disable', 'custom-permalink') ?></small>
|
427 |
if ( !isset($_REQUEST['custom_permalinks_edit']) ) return;
|
428 |
|
429 |
delete_post_meta( $id, 'custom_permalink' );
|
430 |
+
if ( $_REQUEST['custom_permalink'] && $_REQUEST['custom_permalink'] != custom_permalinks_original_post_link($id) ) {
|
431 |
+
if ( dirname($_REQUEST['custom_permalink']) == dirname(custom_permalinks_original_post_link($id)) ) {
|
432 |
+
// Just slug changed
|
433 |
+
$post = wp_get_single_post($id, ARRAY_A);
|
434 |
+
$new_name = basename($_REQUEST['custom_permalink']);
|
435 |
+
$new_name = wp_unique_post_slug($new_name, $id, $post['post_status'], $post['post_type'], $post['post_parent']);
|
436 |
+
|
437 |
+
global $wpdb;
|
438 |
+
$wpdb->update($wpdb->posts, array('post_name' => $new_name), array('ID' => $id));
|
439 |
+
} else {
|
440 |
+
add_post_meta( $id, 'custom_permalink', ltrim(stripcslashes($_REQUEST['custom_permalink']),"/") );
|
441 |
+
}
|
442 |
+
}
|
443 |
}
|
444 |
|
445 |
|
633 |
$row['permalink'] = get_permalink($post->ID);
|
634 |
$row['type'] = ucwords( $post->post_type );
|
635 |
$row['title'] = $post->post_title;
|
636 |
+
$row['editlink'] = 'post.php?action=edit&post='.$post->ID;
|
637 |
$rows[] = $row;
|
638 |
}
|
639 |
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@
|
|
3 |
Donate link: http://atastypixel.com/blog/wordpress/plugins/custom-permalinks/
|
4 |
Tags: permalink, url, link, address, custom, redirect
|
5 |
Requires at least: 2.6
|
6 |
-
Tested up to: 3.1
|
7 |
-
Stable tag: 0.7.
|
8 |
|
9 |
Set custom permalinks on a per-post, per-tag or per-category basis.
|
10 |
|
@@ -23,6 +23,11 @@ over your site structure.
|
|
23 |
|
24 |
== Changelog ==
|
25 |
|
|
|
|
|
|
|
|
|
|
|
26 |
= 0.7.3 =
|
27 |
|
28 |
* Fix problem with /page/# URLs on WP 3.1.3
|
@@ -98,9 +103,6 @@ over your site structure.
|
|
98 |
|
99 |
== Upgrade Notice ==
|
100 |
|
101 |
-
|
102 |
-
== Changelog ==
|
103 |
-
|
104 |
= 0.6.1 =
|
105 |
|
106 |
* This release fixes a bug causing incorrect link from the "View Post"/"View Page" button in the editor
|
3 |
Donate link: http://atastypixel.com/blog/wordpress/plugins/custom-permalinks/
|
4 |
Tags: permalink, url, link, address, custom, redirect
|
5 |
Requires at least: 2.6
|
6 |
+
Tested up to: 3.2.1
|
7 |
+
Stable tag: 0.7.4
|
8 |
|
9 |
Set custom permalinks on a per-post, per-tag or per-category basis.
|
10 |
|
23 |
|
24 |
== Changelog ==
|
25 |
|
26 |
+
= 0.7.4 =
|
27 |
+
|
28 |
+
* Added support for changing post/page slug only
|
29 |
+
* Fixed incorrect admin edit link
|
30 |
+
|
31 |
= 0.7.3 =
|
32 |
|
33 |
* Fix problem with /page/# URLs on WP 3.1.3
|
103 |
|
104 |
== Upgrade Notice ==
|
105 |
|
|
|
|
|
|
|
106 |
= 0.6.1 =
|
107 |
|
108 |
* This release fixes a bug causing incorrect link from the "View Post"/"View Page" button in the editor
|