WordPress.org

Make WordPress Core

Changeset 1388


Ignore:
Timestamp:
06/06/2004 02:02:27 AM (14 years ago)
Author:
rboren
Message:

Rewrite and %category% fixes.

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.php

    r1382 r1388  
    12391239             }
    12401240
    1241     $structure = str_replace($front, '', $permalink_structure);
     1241    $structure = $permalink_structure;
     1242    if ($front != '/') {
     1243        $structure = str_replace($front, '', $structure);
     1244    }
    12421245    $structure = trim($structure, '/');
    12431246    $dirs = explode('/', $structure);
     
    13131316    // separate archive rule.
    13141317    $doarchive = false;
    1315     if (! (strstr($permalink_structure, '%year') && strstr($permalink_structure, '%monthnum') && strstr($permalink_structure, '%day')) ) {
     1318    if (! (strstr($permalink_structure, '%year%') && strstr($permalink_structure, '%monthnum%') && strstr($permalink_structure, '%day%')) ||
     1319        preg_match('/%category%.*(%year%|%monthnum%|%day%)/', $permalink_structure)) {
    13161320        $doarchive = true;
    13171321        $archive_structure = $front . '%year%/%monthnum%/%day%/';
  • trunk/wp-includes/template-functions-links.php

    r1385 r1388  
    8181        // If the permalink structure does not contain year and month, make
    8282        // one that does.
    83         if (! (strstr($permalink, '%year') && strstr($permalink, '%monthnum')) ) {
     83        if (! (strstr($permalink, '%year%') && strstr($permalink, '%monthnum%'))
     84            || preg_match('/%category%.*(%year%|%monthnum%|%day%)/', $permalink)) {
    8485            $front = substr($permalink, 0, strpos($permalink, '%'));
    8586            $permalink = $front . '%year%/%monthnum%/';
     
    9394        $monthlink = str_replace('%monthnum%', zeroise(intval($month), 2), $monthlink);
    9495        $monthlink = str_replace('%post_id%', '', $monthlink);
     96        $monthlink = str_replace('%category%', '', $monthlink);
    9597        return get_settings('home') . $monthlink;
    9698    } else {
     
    109111        // If the permalink structure does not contain year, month, and day,
    110112        // make one that does.
    111         if (! (strstr($permalink, '%year') && strstr($permalink, '%monthnum')) ) {
     113        if (! (strstr($permalink, '%year%') && strstr($permalink, '%monthnum%')&& strstr($permalink, '%day%'))
     114            || preg_match('/%category%.*(%year%|%monthnum%|%day%)/', $permalink)) {
    112115            $front = substr($permalink, 0, strpos($permalink, '%'));
    113116            $permalink = $front . '%year%/%monthnum%/%day%/';
     
    122125        $daylink = str_replace('%day%', zeroise(intval($day), 2), $daylink);
    123126        $daylink = str_replace('%post_id%', '', $daylink);
     127        $daylink = str_replace('%category%', '', $daylink);
    124128        return get_settings('home') . $daylink;
    125129    } else {
Note: See TracChangeset for help on using the changeset viewer.