diff --git a/b2-include/b2template.functions.php b/b2-include/b2template.functions.php
index 43c498dc3..f99a96747 100644
--- a/b2-include/b2template.functions.php
+++ b/b2-include/b2template.functions.php
@@ -1405,6 +1405,29 @@ function trackback_rdf($timezone = 0) {
/***** Permalink tags *****/
+function get_permalink($id=false) {
+ global $post;
+ if (!$id) {
+ if (get_settings('permalink_structure')) {
+ $unixtime = strtotime($post->post_date);
+ $rewritecode = array(
+ '%year%',
+ '%monthnum%',
+ '%day%',
+ '%postname%'
+ );
+ $rewritereplace = array(
+ date('Y', $unixtime),
+ date('n', $unixtime),
+ date('j', $unixtime),
+ $post->post_name
+ );
+ return str_replace($rewritecode, $rewritereplace, get_settings('permalink_structure'));
+ } else { // if they're not using the fancy permalink option
+ return $file.$querystring_start.'p'.$querystring_equal.$post->ID;
+ }
+ }
+}
function permalink_anchor($mode = 'id') {
global $id, $post;
@@ -1434,25 +1457,7 @@ function permalink_link($file='', $mode = 'id') {
$anchor = $id;
break;
}
- $archive_mode = get_settings('archive_mode');
- switch($archive_mode) {
- case 'daily':
- echo $file.$querystring_start.'m'.$querystring_equal.substr($post->post_date,0,4).substr($post->post_date,5,2).substr($postdata['Date'],8,2).'#post-'.$anchor;
- break;
- case 'monthly':
- echo $file.$querystring_start.'m'.$querystring_equal.substr($post->post_date,0,4).substr($post->post_date,5,2).'#post-'.$anchor;
- break;
- case 'weekly':
- if((!isset($cacheweekly)) || (empty($cacheweekly[$postdata['Date']]))) {
- $cacheweekly[$post->post_date] = $wpdb->get_var("SELECT WEEK('$post->post_date')");
- ++$querycount;
- }
- echo $file.$querystring_start.'m'.$querystring_equal.substr($post->post_date,0,4).$querystring_separator.'w'.$querystring_equal.$cacheweekly[$post->post_date].'#post-'.$anchor;
- break;
- case 'postbypost':
- echo $file.$querystring_start.'p'.$querystring_equal.$id;
- break;
- }
+ echo get_permalink();
}
function permalink_single($file='') {
diff --git a/blog.header.php b/blog.header.php
index ce033331f..e6f5744f5 100644
--- a/blog.header.php
+++ b/blog.header.php
@@ -13,7 +13,7 @@ require_once ($curpath.$b2inc.'/b2functions.php');
require_once ($curpath.$b2inc.'/xmlrpc.inc');
require_once ($curpath.$b2inc.'/xmlrpcs.inc');
-$b2varstoreset = array('m','p','posts','w','c', 'cat','withcomments','s','search','exact', 'sentence','poststart','postend','preview','debug', 'calendar','page','paged','more','tb', 'pb','author','order','orderby');
+$b2varstoreset = array('m','p','posts','w','c', 'cat','withcomments','s','search','exact', 'sentence','poststart','postend','preview','debug', 'calendar','page','paged','more','tb', 'pb','author','order','orderby', 'monthnum');
for ($i=0; $i Sorry, no posts matched your criteria.
See, that didn’t hurt a bit. All done!
diff --git a/wp-admin/wp-options-permalink.php b/wp-admin/wp-options-permalink.php new file mode 100644 index 000000000..dd1c87257 --- /dev/null +++ b/wp-admin/wp-options-permalink.php @@ -0,0 +1,143 @@ + $v) { + if (is_array($v)) { + $array[$k] = add_magic_quotes($v); + } else { + $array[$k] = addslashes($v); + } + } + return $array; +} + +if (!get_magic_quotes_gpc()) { + $HTTP_GET_VARS = add_magic_quotes($HTTP_GET_VARS); + $HTTP_POST_VARS = add_magic_quotes($HTTP_POST_VARS); + $HTTP_COOKIE_VARS = add_magic_quotes($HTTP_COOKIE_VARS); +} + +$b2varstoreset = array('action','standalone', 'option_group_id'); +for ($i=0; $iWordPress offers you the ability to create a custom URI structure for your permalinks and archives. The following “tags” are available:
+%year%
--- The year of the post, 4 digits, for example 2003 %monthnum%
--- Two digit month, for example 05%day%
--- Day of the month, for example 28%postname%
--- A sanitized version of the title of the post. So "This Is A Great Post!" becomes "this-is-a-great-post" %category%
--- Category name of the post. For example "general". Not done yet. So for example a value like /%year%/%monthnum%/%day%/%postname%
could give you a permalink like /2003/05/23/my-cheese-sandwich
. For this to work you'll need mod_rewrite installed on your server for the rule generation rule to work below. In the future there may be other options.
Using the permalink structure value you currently have, , these are the mod_rewrite rules you should have in your
.htaccess
file.
RewriteEngine On
+ RewriteBase
+ RewriteRule ^ [QSA]