Version Description
- fix for deeper nested pages
Download this release
Release Info
Developer | FolioVision |
Plugin | FV Top Level Categories |
Version | 1.1.3 |
Comparing to | |
See all releases |
Code changes from version 1.1.2 to 1.1.3
- readme.txt +10 -3
- top-level-cats.php +6 -36
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://foliovision.com/seo-tools/wordpress/plugins/fv-top-level-cat
|
|
4 |
Tags: categories, permalink
|
5 |
Requires at least: 3.1
|
6 |
Tested up to: 3.1
|
7 |
-
Stable tag: 1.
|
8 |
|
9 |
This is a fix of Top Level Category plugin for Wordpress 3.1.
|
10 |
|
@@ -14,7 +14,7 @@ This is a fix of Top Level Category plugin for Wordpress 3.1. It's purpose is to
|
|
14 |
|
15 |
The Top Level Categories plugin allows you to remove the prefix before the URL to your category page. For example, instead of http://foliovision.com/category/work, you can use http://foliovision.com/work for the address of "work" category. WordPress doesn't allow you to have a blank prefix for categories (they insert `category/` before the name), this plugin works around that restriction.
|
16 |
|
17 |
-
This plugin works also if you have a permalink structure like %postname% or %category%/%postname% -- this wasn't possible in the original version
|
18 |
|
19 |
[Support](http://foliovision.com/seo-tools/wordpress/plugins/fv-top-level-categories)
|
20 |
|
@@ -32,7 +32,11 @@ This plugin works also if you have a permalink structure like %postname% or %cat
|
|
32 |
|
33 |
= How do I automatically redirect people from the old category permalink? =
|
34 |
|
35 |
-
We recommend that you use the [Redirection](http://wordpress.org/extend/plugins/redirection/) plugin and add your old an new category links, or use a Regex redirection rule.
|
|
|
|
|
|
|
|
|
36 |
|
37 |
== Uninstall ==
|
38 |
|
@@ -41,6 +45,9 @@ We recommend that you use the [Redirection](http://wordpress.org/extend/plugins/
|
|
41 |
|
42 |
== Changelog ==
|
43 |
|
|
|
|
|
|
|
44 |
= 1.1.2 =
|
45 |
* fix for /category/child-category redirecting to /child-category page
|
46 |
|
4 |
Tags: categories, permalink
|
5 |
Requires at least: 3.1
|
6 |
Tested up to: 3.1
|
7 |
+
Stable tag: 1.3
|
8 |
|
9 |
This is a fix of Top Level Category plugin for Wordpress 3.1.
|
10 |
|
14 |
|
15 |
The Top Level Categories plugin allows you to remove the prefix before the URL to your category page. For example, instead of http://foliovision.com/category/work, you can use http://foliovision.com/work for the address of "work" category. WordPress doesn't allow you to have a blank prefix for categories (they insert `category/` before the name), this plugin works around that restriction.
|
16 |
|
17 |
+
This plugin works also if you have a permalink structure like %postname% or %category%/%postname% -- this wasn't possible in the original version. However, this feature might not work properly for child categories at this point. Test carefully!
|
18 |
|
19 |
[Support](http://foliovision.com/seo-tools/wordpress/plugins/fv-top-level-categories)
|
20 |
|
32 |
|
33 |
= How do I automatically redirect people from the old category permalink? =
|
34 |
|
35 |
+
We recommend that you use the [Redirection](http://wordpress.org/extend/plugins/redirection/) plugin and add your old an new category links, or use a Regex redirection rule. Make sure you change Tools -> Redirection -> Options -> URL Monitoring to "Don't monitor", as there is a [bug](http://wordpress.org/support/topic/plugin-redirection-my-homepage-is-being-redirected-to-a-page-need-some-help) in that feature (also in latest current version 2.2.5) - not related to FV Top Level Categories.
|
36 |
+
|
37 |
+
= I'm having issues with child categories when I'm using /%category%/%postname% permalink structure =
|
38 |
+
|
39 |
+
Make sure your categories have unique slugs - watch out for pages with the same slugs. Normally Wordpress uses the category prefix to distinguish page from a category, but with this plugin you need to make sure the slugs are unique, otherwise some pages might turn up instead of categories.
|
40 |
|
41 |
== Uninstall ==
|
42 |
|
45 |
|
46 |
== Changelog ==
|
47 |
|
48 |
+
= 1.1.3 =
|
49 |
+
* fix for deeper nested pages
|
50 |
+
|
51 |
= 1.1.2 =
|
52 |
* fix for /category/child-category redirecting to /child-category page
|
53 |
|
top-level-cats.php
CHANGED
@@ -3,17 +3,9 @@
|
|
3 |
Plugin Name: FV Top Level Categories
|
4 |
Plugin URI: http://foliovision.com/seo-tools/wordpress/plugins/fv-top-level-categories
|
5 |
Description: Removes the prefix from the URL for a category. For instance, if your old category link was <code>/category/catname</code> it will now be <code>/catname</code>
|
6 |
-
Version: 1.1.
|
7 |
Author: Foliovision
|
8 |
Author URI: http://foliovision.com/
|
9 |
-
*/
|
10 |
-
|
11 |
-
/*
|
12 |
-
Changelog
|
13 |
-
1.1.2 fix for /category/child-category redirecting to /child-category page
|
14 |
-
1.1.1 fix for deeper nested categories
|
15 |
-
1.1 FV Fix for WP 3.1
|
16 |
-
1.0.1 Original version
|
17 |
*/
|
18 |
|
19 |
// In case we're running standalone, for some odd reason
|
@@ -116,41 +108,19 @@ function fv_request_page_instead_category($query_string)
|
|
116 |
{
|
117 |
//echo '<!-- before '.var_export( $query_string, true ).'-->';
|
118 |
|
119 |
-
// enable this and disable top_level_cats_category_rewrite_rules, top_level_cats_generate_rewrite_rules to prefer categories over pages
|
120 |
-
/*if( isset( $query_string['pagename'] ) ) {
|
121 |
-
$cats = get_categories();
|
122 |
-
foreach( $cats AS $cat_item ) {
|
123 |
-
if( $cat_item->slug == $query_string['pagename'] ) {
|
124 |
-
$query_string['category_name'] = $query_string['pagename'];
|
125 |
-
unset( $query_string['pagename'] );
|
126 |
-
}
|
127 |
-
}
|
128 |
-
} */
|
129 |
if( isset( $query_string['category_name'] ) ) {
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
$slug = $wpdb->escape( trim( substr( $query_string['category_name'], strripos( $query_string['category_name'], '/' ) ), '/' ) );
|
134 |
-
$page_exists = $wpdb->get_row( "SELECT ID, post_parent FROM $wpdb->posts WHERE post_name='{$slug}' AND post_type = 'page' AND post_status = 'publish' " );
|
135 |
-
|
136 |
-
if( $page_exists && $page_exists->post_parent && stripos( $query_string['category_name'], '/' ) !== FALSE ) {
|
137 |
-
$query_string['page_id'] = $page_exists->ID;
|
138 |
-
unset( $query_string['category_name'] );
|
139 |
-
}
|
140 |
-
if( $page_exists && !$page_exists->post_parent && count( $parts ) == 1 ) { // fix for /category/child-category redirecting to /child-category page
|
141 |
$query_string['pagename'] = $query_string['category_name'];
|
142 |
unset( $query_string['category_name'] );
|
|
|
|
|
143 |
}
|
144 |
}
|
145 |
//echo '<!-- after '.var_export( $query_string, true ).'-->';
|
146 |
|
147 |
return $query_string; // end
|
148 |
}
|
149 |
-
|
150 |
-
/*function fv_redirect_canonical( $url ) {
|
151 |
-
if( $url == 'http://localhost/wordpress-3.1/uncategorized/child' ) return false;
|
152 |
-
return $url;
|
153 |
-
}
|
154 |
-
add_filter( 'redirect_canonical', 'fv_redirect_canonical' );*/
|
155 |
|
156 |
?>
|
3 |
Plugin Name: FV Top Level Categories
|
4 |
Plugin URI: http://foliovision.com/seo-tools/wordpress/plugins/fv-top-level-categories
|
5 |
Description: Removes the prefix from the URL for a category. For instance, if your old category link was <code>/category/catname</code> it will now be <code>/catname</code>
|
6 |
+
Version: 1.1.3
|
7 |
Author: Foliovision
|
8 |
Author URI: http://foliovision.com/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
*/
|
10 |
|
11 |
// In case we're running standalone, for some odd reason
|
108 |
{
|
109 |
//echo '<!-- before '.var_export( $query_string, true ).'-->';
|
110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
if( isset( $query_string['category_name'] ) ) {
|
112 |
+
$test_query = new WP_Query( 'pagename='.$query_string['category_name'] );
|
113 |
+
//echo '<!-- test_query '.var_export( $test_query->post_count, true ).'-->';
|
114 |
+
if( $test_query->post_count ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
$query_string['pagename'] = $query_string['category_name'];
|
116 |
unset( $query_string['category_name'] );
|
117 |
+
//echo '<!-- after '.var_export( $query_string, true ).'-->';
|
118 |
+
return $query_string;
|
119 |
}
|
120 |
}
|
121 |
//echo '<!-- after '.var_export( $query_string, true ).'-->';
|
122 |
|
123 |
return $query_string; // end
|
124 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
|
126 |
?>
|