Version Description
(02/12/2010) = * Fix: fixed "customization" of urls using cyrillic alphabet and other characters generally not safe (thank you for the report zamuta).
Download this release
Release Info
Developer | dardna |
Plugin | WP htaccess Control |
Version | 2.1 |
Comparing to | |
See all releases |
Code changes from version 2.0 to 2.1
- readme.txt +53 -50
- wp-htaccess-control.php +17 -10
readme.txt
CHANGED
@@ -6,7 +6,7 @@ Donate link:
|
|
6 |
Tags: permalinks, permalink, author, htaccess, rewrite, redirect, admin, maintenance, pagination, category, category base, archive, archives
|
7 |
Requires at least: 2.7
|
8 |
Tested up to: 3.0.1
|
9 |
-
Stable tag: 2.
|
10 |
|
11 |
Interface to customize the permalinks (author, category, archives and pagination) and htaccess file generated by Wordpress.
|
12 |
|
@@ -15,15 +15,13 @@ Interface to customize the permalinks (author, category, archives and pagination
|
|
15 |
**WP htaccess Control** provides an interface to customize permalinks (author, category, archives and pagination) and the htaccess file generated by Wordpress. (Take a look at the screenshot...)
|
16 |
Despite the name, many of the options now present on this plugin do not use the htaccess file but the wordpress internal rewrite.
|
17 |
|
18 |
-
**I still haven't tested this under Wordpress multisite, issues have however been reported.**
|
19 |
-
|
20 |
**Features:**
|
21 |
|
22 |
* Customizing the htaccess file generated by Wordpress;
|
23 |
* Removing the category base;
|
24 |
-
* Customizing the Author Permalink Base
|
25 |
* Customizing Paginated Permalinks (translate the "page" word on permalinks to your own language);
|
26 |
-
* Category, Author and Tag based archives (ex:
|
27 |
* Maintenance mode.
|
28 |
|
29 |
**Easy to use "Suggested htaccess" rules:**
|
@@ -42,11 +40,9 @@ Despite the name, many of the options now present on this plugin do not use the
|
|
42 |
* Set admin email on server generated error pages;
|
43 |
* Disable ServerSignature on server generated error pages.
|
44 |
|
45 |
-
**Translated to:** pt_BR and pt_PT.
|
46 |
-
|
47 |
-
(POT file is included, translations are welcome)
|
48 |
|
49 |
-
Removal of the category base is based on iDope's
|
50 |
|
51 |
== Installation ==
|
52 |
|
@@ -65,102 +61,109 @@ Suggestions are welcome and please report any bugs found!
|
|
65 |
|
66 |
1. Administration page (as of v.2.0)
|
67 |
|
|
|
|
|
|
|
|
|
68 |
== Changelog ==
|
69 |
|
|
|
|
|
|
|
70 |
= 2.0 (27/11/2010) =
|
71 |
-
* Feature
|
72 |
-
* Feature
|
73 |
|
74 |
= 1.9.1 (22/10/2010) =
|
75 |
-
* Feature
|
76 |
|
77 |
= 1.9 (22/10/2010) =
|
78 |
-
* Feature
|
79 |
|
80 |
= 1.8 (09/09/2010) =
|
81 |
-
* Feature
|
82 |
-
* Feature
|
83 |
-
* Fix
|
84 |
-
* Fix
|
85 |
|
86 |
= 1.7 (01/09/2010) =
|
87 |
-
* Feature
|
88 |
|
89 |
= 1.6.1 (17/08/2010) =
|
90 |
-
* Fix
|
91 |
|
92 |
= 1.6 (17/08/2010) =
|
93 |
-
* Feature
|
94 |
|
95 |
= 1.5.5 (25/06/2010) =
|
96 |
-
* Feature
|
97 |
-
* Fix
|
98 |
|
99 |
= 1.5.4 (24/06/2010) =
|
100 |
-
* Fix
|
101 |
* Confirmed compatibility with WP 3.0.
|
102 |
|
103 |
= 1.5.3 (01/06/2010) =
|
104 |
-
* Fix
|
105 |
|
106 |
= 1.5.2 (02/05/2010) =
|
107 |
-
* Fix
|
108 |
|
109 |
= 1.5.1 (01/05/2010) =
|
110 |
-
* Fix
|
111 |
-
* Fix
|
112 |
-
* Fix
|
113 |
|
114 |
= 1.5 (25/03/2010) =
|
115 |
-
* Feature
|
116 |
-
* Feature
|
117 |
|
118 |
= 1.4.3 (22/03/2010) =
|
119 |
-
* Fix
|
120 |
-
* Change
|
121 |
-
* Change
|
122 |
|
123 |
= 1.4.2 (12/03/2010) =
|
124 |
-
* Change
|
125 |
|
126 |
= 1.4.1 (12/03/2010) =
|
127 |
-
* Fix
|
128 |
|
129 |
= 1.4 (12/03/2010) =
|
130 |
-
* Feature
|
131 |
-
* Change
|
132 |
|
133 |
= 1.3 (10/03/2010) =
|
134 |
-
* Feature
|
135 |
-
* Change
|
136 |
|
137 |
= 1.2.1 (15/02/2010) =
|
138 |
-
* Fix
|
139 |
-
* Fix
|
140 |
* Confirmed compatibility with WP 2.9.2.
|
141 |
|
142 |
= 1.2 (15/02/2010) =
|
143 |
-
* Change
|
144 |
|
145 |
= 1.1.4 (05/02/2010) =
|
146 |
-
* Fix
|
147 |
-
* Change
|
148 |
* Confirmed compatibility with WP 2.9.1.
|
149 |
|
150 |
= 1.1.3 (06/07/2009) =
|
151 |
-
* Fix
|
152 |
-
* Fix
|
153 |
|
154 |
= 1.1.2 (01/07/2009) =
|
155 |
-
* Change
|
156 |
* Confirmed compatibility with WP 2.8.
|
157 |
|
158 |
= 1.1.1 (09/04/2009) =
|
159 |
-
* Change
|
160 |
|
161 |
= 1.1 (09/04/2009) =
|
162 |
-
* Change
|
163 |
-
* Change
|
164 |
|
165 |
= 1.0.1 (08/04/2009) =
|
166 |
* Added GNU license.
|
6 |
Tags: permalinks, permalink, author, htaccess, rewrite, redirect, admin, maintenance, pagination, category, category base, archive, archives
|
7 |
Requires at least: 2.7
|
8 |
Tested up to: 3.0.1
|
9 |
+
Stable tag: 2.1
|
10 |
|
11 |
Interface to customize the permalinks (author, category, archives and pagination) and htaccess file generated by Wordpress.
|
12 |
|
15 |
**WP htaccess Control** provides an interface to customize permalinks (author, category, archives and pagination) and the htaccess file generated by Wordpress. (Take a look at the screenshot...)
|
16 |
Despite the name, many of the options now present on this plugin do not use the htaccess file but the wordpress internal rewrite.
|
17 |
|
|
|
|
|
18 |
**Features:**
|
19 |
|
20 |
* Customizing the htaccess file generated by Wordpress;
|
21 |
* Removing the category base;
|
22 |
+
* Customizing the Author Permalink Base;
|
23 |
* Customizing Paginated Permalinks (translate the "page" word on permalinks to your own language);
|
24 |
+
* Category, Author and Tag based archives (ex: *http://your-site.com/category/stories/2010/12*, *http://your-site.com/author/admin/2010/12/page/2* and *http://your-site.com/tag/wordpress/2010/12*), this will also work if you've removed the category base;
|
25 |
* Maintenance mode.
|
26 |
|
27 |
**Easy to use "Suggested htaccess" rules:**
|
40 |
* Set admin email on server generated error pages;
|
41 |
* Disable ServerSignature on server generated error pages.
|
42 |
|
43 |
+
**Translated to:** pt_BR and pt_PT. (POT file is included, translations are welcome)
|
|
|
|
|
44 |
|
45 |
+
Removal of the category base is based on iDope's **WP No Category Base** but extended so that it works with category archives (ie.: *http://example.com/my-category/2010/12*)
|
46 |
|
47 |
== Installation ==
|
48 |
|
61 |
|
62 |
1. Administration page (as of v.2.0)
|
63 |
|
64 |
+
== Known Issues ==
|
65 |
+
|
66 |
+
I still haven't tested this under **Wordpress multisite**, issues have however been reported.
|
67 |
+
|
68 |
== Changelog ==
|
69 |
|
70 |
+
= 2.1 (02/12/2010) =
|
71 |
+
* *Fix:* fixed "customization" of urls using cyrillic alphabet and other characters generally not safe (thank you for the report zamuta).
|
72 |
+
|
73 |
= 2.0 (27/11/2010) =
|
74 |
+
* *Feature:* removal of the category base;
|
75 |
+
* *Feature:* archives for categories with no base (ie.: "http://example.com/my-category/2010/12") (again, good point webakimbo).
|
76 |
|
77 |
= 1.9.1 (22/10/2010) =
|
78 |
+
* *Feature:* adding "Author and Tag based archives".
|
79 |
|
80 |
= 1.9 (22/10/2010) =
|
81 |
+
* *Feature:* adding "Category-based archives" (good idea webakimbo).
|
82 |
|
83 |
= 1.8 (09/09/2010) =
|
84 |
+
* *Feature:* adding "Maintenance Mode";
|
85 |
+
* *Feature:* adding 403 error page "htaccess suggestion";
|
86 |
+
* *Fix:* deprecating the "Rewrite Pairs" as they are superseded by the "Custom htaccess";
|
87 |
+
* *Fix:* small fix to "original rules" on wordpress htaccess (thank you Agnes for the report).
|
88 |
|
89 |
= 1.7 (01/09/2010) =
|
90 |
+
* *Feature:* wordpress htaccess rules can be replaced or modified.
|
91 |
|
92 |
= 1.6.1 (17/08/2010) =
|
93 |
+
* *Fix:* Small update on Jim Morgan's htaccess;
|
94 |
|
95 |
= 1.6 (17/08/2010) =
|
96 |
+
* *Feature:* added "suggestion" to use Jim Morgan's htaccess as discussed in http://wordpress.org/extend/ideas/topic/wordpress-performance-improvement-that-does-not-require-a-plugin-simple-fix (thank you Will for pointing it out);
|
97 |
|
98 |
= 1.5.5 (25/06/2010) =
|
99 |
+
* *Feature:* added i18n files and portuguese translation;
|
100 |
+
* *Fix:* mistagged stable version.
|
101 |
|
102 |
= 1.5.4 (24/06/2010) =
|
103 |
+
* *Fix:* Setting canonical "www." will no longer be done by htaccess but simply by modifying "site url" and "home" options;
|
104 |
* Confirmed compatibility with WP 3.0.
|
105 |
|
106 |
= 1.5.3 (01/06/2010) =
|
107 |
+
* *Fix:* small regex correction on filtered pagination links.
|
108 |
|
109 |
= 1.5.2 (02/05/2010) =
|
110 |
+
* *Fix:* mistake on 1.5.1 would not add wordpress own htaccess rules (thank you JAB_au for the report).
|
111 |
|
112 |
= 1.5.1 (01/05/2010) =
|
113 |
+
* *Fix:* stripped slashes on custom htaccess (thank you Aleksey for the report);
|
114 |
+
* *Fix:* regex correction for custom pagination permalink (link from page two to the first page would still point to second page);
|
115 |
+
* *Fix:* (removed references to "hta_mr").
|
116 |
|
117 |
= 1.5 (25/03/2010) =
|
118 |
+
* *Feature:* customization of the pagination permalinks;
|
119 |
+
* *Feature:* "mod_gzip" and "mod_deflate".
|
120 |
|
121 |
= 1.4.3 (22/03/2010) =
|
122 |
+
* *Fix:* Custom Author Permalink now working when using wp_list_authors (thank you HW for the report);
|
123 |
+
* *Change:* options page should now only be seen by admins;
|
124 |
+
* *Change:* prepared l10n.
|
125 |
|
126 |
= 1.4.2 (12/03/2010) =
|
127 |
+
* *Change:* minor documentation fix (readme).
|
128 |
|
129 |
= 1.4.1 (12/03/2010) =
|
130 |
+
* *Fix:* debug left over on 1.4 for url canonization.
|
131 |
|
132 |
= 1.4 (12/03/2010) =
|
133 |
+
* *Feature:* added "Suggested htaccess";
|
134 |
+
* *Change:* improved ui.
|
135 |
|
136 |
= 1.3 (10/03/2010) =
|
137 |
+
* *Feature:* integrated the Custom Author Permalink with the Google XML Sitemap plugin;
|
138 |
+
* *Change:* two fields to customize the htaccess were being used when only one was needed, for the sake of simplicity.
|
139 |
|
140 |
= 1.2.1 (15/02/2010) =
|
141 |
+
* *Fix:* bug on resetting all rules;
|
142 |
+
* *Fix:* critical bug on empty htaccess custom rules;
|
143 |
* Confirmed compatibility with WP 2.9.2.
|
144 |
|
145 |
= 1.2 (15/02/2010) =
|
146 |
+
* *Change:* improved htaccess customization giving now much more freedom.
|
147 |
|
148 |
= 1.1.4 (05/02/2010) =
|
149 |
+
* *Fix:* "Current htaccess file as it is generated by Wordpress" was not being printed;
|
150 |
+
* *Change:* minor ui changes;
|
151 |
* Confirmed compatibility with WP 2.9.1.
|
152 |
|
153 |
= 1.1.3 (06/07/2009) =
|
154 |
+
* *Fix:* mistake on wphtc_cap()'s preg_replace commited on 1.1.2 (thank you mattcav for the report);
|
155 |
+
* *Fix:* php warning on updating options without htaccess rules.
|
156 |
|
157 |
= 1.1.2 (01/07/2009) =
|
158 |
+
* *Change:* better options handling (no longer creating empty option array on install or reset);
|
159 |
* Confirmed compatibility with WP 2.8.
|
160 |
|
161 |
= 1.1.1 (09/04/2009) =
|
162 |
+
* *Change:* minor documentation fix (screenshot).
|
163 |
|
164 |
= 1.1 (09/04/2009) =
|
165 |
+
* *Change:* separated ui file;
|
166 |
+
* *Change:* improved management and ui.
|
167 |
|
168 |
= 1.0.1 (08/04/2009) =
|
169 |
* Added GNU license.
|
wp-htaccess-control.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: WP htaccess Control
|
4 |
Plugin URI: http://dardna.com/wp-htaccess-control
|
5 |
Description: Provides an interface to add custom htaccess rules to the htaccess file generated by wordpress. Also provides customisation of the Author Permalink Base and of Paginated Permalinks.
|
6 |
-
Version: 2.
|
7 |
Author: António Andrade
|
8 |
Author URI: http://dardna.com
|
9 |
*/
|
@@ -53,8 +53,8 @@ if (!class_exists("WPhtc")) {
|
|
53 |
function wphtc_filter_get_pagenum_link($result){
|
54 |
$WPhtc_data=get_option('WPhtc_data');
|
55 |
if(isset($WPhtc_data['cpp'])&&$WPhtc_data['cpp']!=''){
|
56 |
-
$result=preg_replace("/"
|
57 |
-
$result=str_replace("page"
|
58 |
}
|
59 |
return $result;
|
60 |
}
|
@@ -62,31 +62,32 @@ if (!class_exists("WPhtc")) {
|
|
62 |
function wphtc_filter_author_link($link){
|
63 |
$WPhtc_data=get_option('WPhtc_data');
|
64 |
if(isset($WPhtc_data['cap']) && $WPhtc_data['cap']!=''){
|
65 |
-
$link=str_replace("author"
|
66 |
}
|
67 |
return $link;
|
68 |
}
|
69 |
# Disable canonical redirection on urls using custom pagination permalink
|
70 |
function wphtc_filter_redirect_canonical($redirect_url,$requested_url){
|
71 |
$WPhtc_data=get_option('WPhtc_data');
|
72 |
-
|
|
|
73 |
return false;
|
74 |
}
|
75 |
else{
|
76 |
return $redirect_url;
|
77 |
}
|
78 |
}
|
79 |
-
#
|
80 |
-
# Replacing the Wordpress Author Permalink by rewriting its rules if we have a Custom Author Permalink, everytime the rules are flush
|
81 |
function wphtc_filter_rewrite_rules($rewrite_rules){
|
82 |
$WPhtc_data=get_option('WPhtc_data');
|
83 |
$page_base=($WPhtc_data['cpp']!='')?$WPhtc_data['cpp']:'page';
|
|
|
84 |
if($WPhtc_data['category_archives']){
|
85 |
# If category base removed
|
86 |
if($WPhtc_data['remove_category_base']){
|
87 |
$categories=get_categories(array('hide_empty'=>false));
|
88 |
foreach($categories as $category) {
|
89 |
-
$category_nicename = $category->slug;
|
90 |
if ( $category->parent == $category->cat_ID ){
|
91 |
$category->parent = 0;
|
92 |
}
|
@@ -110,6 +111,7 @@ if (!class_exists("WPhtc")) {
|
|
110 |
$rewrite_rules = $new_rules + $rewrite_rules;
|
111 |
}
|
112 |
}
|
|
|
113 |
if(isset($WPhtc_data['author_archives'])){
|
114 |
$author_base = ($WPhtc_data['cap']!='')?$WPhtc_data['cap']:'author';
|
115 |
$new_rules = array( $author_base.'/([^/]+)/([0-9]{4})/?$' => 'index.php?author_name=$matches[1]&year=$matches[2]',
|
@@ -118,6 +120,7 @@ if (!class_exists("WPhtc")) {
|
|
118 |
$author_base.'/([^/]+)/([0-9]{4})/([0-9]{2})/'.$page_base.'/?([0-9]{1,})/?$' => 'index.php?author_name=$matches[1]&year=$matches[2]&monthnum=$matches[3]&paged=$matches[4]');
|
119 |
$rewrite_rules = $new_rules + $rewrite_rules;
|
120 |
}
|
|
|
121 |
if(isset($WPhtc_data['tag_archives'])){
|
122 |
$new_rules = array( 'tag/([^/]+)/([0-9]{4})/?$' => 'index.php?tag=$matches[1]&year=$matches[2]',
|
123 |
'tag/([^/]+)/([0-9]{4})/'.$page_base.'/?([0-9]{1,})/?$' => 'index.php?tag=$matches[1]&year=$matches[2]&paged=$matches[3]',
|
@@ -125,11 +128,14 @@ if (!class_exists("WPhtc")) {
|
|
125 |
'tag/([^/]+)/([0-9]{4})/([0-9]{2})/'.$page_base.'/?([0-9]{1,})/?$' => 'index.php?tag=$matches[1]&year=$matches[2]&monthnum=$matches[3]&paged=$matches[4]');
|
126 |
$rewrite_rules = $new_rules + $rewrite_rules;
|
127 |
}
|
|
|
128 |
if((isset($WPhtc_data['cap'])&&$WPhtc_data['cap']!='')||(isset($WPhtc_data['cpp'])&&$WPhtc_data['cpp']!='')){
|
129 |
$rewrite_rules=serialize($rewrite_rules);
|
|
|
130 |
if(isset($WPhtc_data['cap'])&&$WPhtc_data['cap']!=''){
|
131 |
$rewrite_rules=str_replace('author/',$WPhtc_data['cap'].'/',$rewrite_rules);
|
132 |
}
|
|
|
133 |
if(isset($WPhtc_data['cpp'])&&$WPhtc_data['cpp']!=''){
|
134 |
$rewrite_rules=str_replace('page/',$WPhtc_data['cpp'].'/',$rewrite_rules);
|
135 |
}
|
@@ -138,7 +144,7 @@ if (!class_exists("WPhtc")) {
|
|
138 |
return $rewrite_rules;
|
139 |
}
|
140 |
# Adding our Custom Author Base to the sitemap generated by Google XML Sitemaps
|
141 |
-
# Adapted from sitemap-core.php line 2036
|
142 |
function set_sm(){
|
143 |
$WPhtc_data=get_option('WPhtc_data');
|
144 |
if(class_exists('GoogleSitemapGenerator')&&$WPhtc_data['cap']!=''){
|
@@ -357,13 +363,14 @@ if (!class_exists("WPhtc")) {
|
|
357 |
}
|
358 |
return $catlink;
|
359 |
}
|
|
|
360 |
function remove_category_base_from_rewrite_rules($category_rewrite) {
|
361 |
$WPhtc_data=get_option('WPhtc_data');
|
362 |
if($WPhtc_data['remove_category_base']){
|
363 |
$category_rewrite=array();
|
364 |
$categories=get_categories(array('hide_empty'=>false));
|
365 |
foreach($categories as $category) {
|
366 |
-
$category_nicename = $category->slug;
|
367 |
if ( $category->parent == $category->cat_ID ){
|
368 |
$category->parent = 0;
|
369 |
}
|
3 |
Plugin Name: WP htaccess Control
|
4 |
Plugin URI: http://dardna.com/wp-htaccess-control
|
5 |
Description: Provides an interface to add custom htaccess rules to the htaccess file generated by wordpress. Also provides customisation of the Author Permalink Base and of Paginated Permalinks.
|
6 |
+
Version: 2.1
|
7 |
Author: António Andrade
|
8 |
Author URI: http://dardna.com
|
9 |
*/
|
53 |
function wphtc_filter_get_pagenum_link($result){
|
54 |
$WPhtc_data=get_option('WPhtc_data');
|
55 |
if(isset($WPhtc_data['cpp'])&&$WPhtc_data['cpp']!=''){
|
56 |
+
$result=preg_replace("/".urlencode($WPhtc_data['cpp'])."\/[0-9]+[\/]?/","",$result);
|
57 |
+
$result=str_replace("page",urlencode($WPhtc_data['cpp']),$result);
|
58 |
}
|
59 |
return $result;
|
60 |
}
|
62 |
function wphtc_filter_author_link($link){
|
63 |
$WPhtc_data=get_option('WPhtc_data');
|
64 |
if(isset($WPhtc_data['cap']) && $WPhtc_data['cap']!=''){
|
65 |
+
$link=str_replace("author",urlencode($WPhtc_data['cap']),$link);
|
66 |
}
|
67 |
return $link;
|
68 |
}
|
69 |
# Disable canonical redirection on urls using custom pagination permalink
|
70 |
function wphtc_filter_redirect_canonical($redirect_url,$requested_url){
|
71 |
$WPhtc_data=get_option('WPhtc_data');
|
72 |
+
return false;
|
73 |
+
if(isset($WPhtc_data['cpp'])&&$WPhtc_data['cpp']!=''&&get_query_var('paged') > 1&&strpos($requested_url,urlencode($WPhtc_data['cpp']))){
|
74 |
return false;
|
75 |
}
|
76 |
else{
|
77 |
return $redirect_url;
|
78 |
}
|
79 |
}
|
80 |
+
# Rewrite Rulus: Add Category + Tag + Author Archives; Custom Pagination; Custom Author Base
|
|
|
81 |
function wphtc_filter_rewrite_rules($rewrite_rules){
|
82 |
$WPhtc_data=get_option('WPhtc_data');
|
83 |
$page_base=($WPhtc_data['cpp']!='')?$WPhtc_data['cpp']:'page';
|
84 |
+
# Category Archives
|
85 |
if($WPhtc_data['category_archives']){
|
86 |
# If category base removed
|
87 |
if($WPhtc_data['remove_category_base']){
|
88 |
$categories=get_categories(array('hide_empty'=>false));
|
89 |
foreach($categories as $category) {
|
90 |
+
$category_nicename = urldecode($category->slug);
|
91 |
if ( $category->parent == $category->cat_ID ){
|
92 |
$category->parent = 0;
|
93 |
}
|
111 |
$rewrite_rules = $new_rules + $rewrite_rules;
|
112 |
}
|
113 |
}
|
114 |
+
# Author Archives
|
115 |
if(isset($WPhtc_data['author_archives'])){
|
116 |
$author_base = ($WPhtc_data['cap']!='')?$WPhtc_data['cap']:'author';
|
117 |
$new_rules = array( $author_base.'/([^/]+)/([0-9]{4})/?$' => 'index.php?author_name=$matches[1]&year=$matches[2]',
|
120 |
$author_base.'/([^/]+)/([0-9]{4})/([0-9]{2})/'.$page_base.'/?([0-9]{1,})/?$' => 'index.php?author_name=$matches[1]&year=$matches[2]&monthnum=$matches[3]&paged=$matches[4]');
|
121 |
$rewrite_rules = $new_rules + $rewrite_rules;
|
122 |
}
|
123 |
+
# Tag Archives
|
124 |
if(isset($WPhtc_data['tag_archives'])){
|
125 |
$new_rules = array( 'tag/([^/]+)/([0-9]{4})/?$' => 'index.php?tag=$matches[1]&year=$matches[2]',
|
126 |
'tag/([^/]+)/([0-9]{4})/'.$page_base.'/?([0-9]{1,})/?$' => 'index.php?tag=$matches[1]&year=$matches[2]&paged=$matches[3]',
|
128 |
'tag/([^/]+)/([0-9]{4})/([0-9]{2})/'.$page_base.'/?([0-9]{1,})/?$' => 'index.php?tag=$matches[1]&year=$matches[2]&monthnum=$matches[3]&paged=$matches[4]');
|
129 |
$rewrite_rules = $new_rules + $rewrite_rules;
|
130 |
}
|
131 |
+
# Custom Pagination; Custom Author Permalink
|
132 |
if((isset($WPhtc_data['cap'])&&$WPhtc_data['cap']!='')||(isset($WPhtc_data['cpp'])&&$WPhtc_data['cpp']!='')){
|
133 |
$rewrite_rules=serialize($rewrite_rules);
|
134 |
+
# Author
|
135 |
if(isset($WPhtc_data['cap'])&&$WPhtc_data['cap']!=''){
|
136 |
$rewrite_rules=str_replace('author/',$WPhtc_data['cap'].'/',$rewrite_rules);
|
137 |
}
|
138 |
+
# Pagination
|
139 |
if(isset($WPhtc_data['cpp'])&&$WPhtc_data['cpp']!=''){
|
140 |
$rewrite_rules=str_replace('page/',$WPhtc_data['cpp'].'/',$rewrite_rules);
|
141 |
}
|
144 |
return $rewrite_rules;
|
145 |
}
|
146 |
# Adding our Custom Author Base to the sitemap generated by Google XML Sitemaps
|
147 |
+
# Adapted from sitemap-core.php (line ~2036)
|
148 |
function set_sm(){
|
149 |
$WPhtc_data=get_option('WPhtc_data');
|
150 |
if(class_exists('GoogleSitemapGenerator')&&$WPhtc_data['cap']!=''){
|
363 |
}
|
364 |
return $catlink;
|
365 |
}
|
366 |
+
# Filter Category Rewrite Rules
|
367 |
function remove_category_base_from_rewrite_rules($category_rewrite) {
|
368 |
$WPhtc_data=get_option('WPhtc_data');
|
369 |
if($WPhtc_data['remove_category_base']){
|
370 |
$category_rewrite=array();
|
371 |
$categories=get_categories(array('hide_empty'=>false));
|
372 |
foreach($categories as $category) {
|
373 |
+
$category_nicename = urldecode($category->slug);
|
374 |
if ( $category->parent == $category->cat_ID ){
|
375 |
$category->parent = 0;
|
376 |
}
|