Make WordPress Core

Changeset 574


Ignore:
Timestamp:
12/07/2003 08:59:05 AM (21 years ago)
Author:
saxmatt
Message:

Now select categories from new table and such.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/blog.header.php

    r572 r574  
    1414require_once ($curpath.$b2inc.'/xmlrpcs.inc');
    1515
    16 $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', 'year', 'monthnum', 'day', 'name', 'category_nicename');
     16$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', 'year', 'monthnum', 'day', 'name', 'category_name');
    1717
    1818    for ($i=0; $i<count($b2varstoreset); $i += 1) {
     
    5959$limits = '';
    6060$distinct = '';
     61$join = '';
    6162
    6263if ($pagenow != 'wp-post.php') { timer_start(); }
     
    156157        $andor = 'OR';
    157158    }
     159    $join = " LEFT JOIN $tablepost2cat ON ($tableposts.ID = $tablepost2cat.post_id) ";
    158160    $cat_array = explode(' ',$cat);
    159     $whichcat .= ' AND (post_category '.$eq.' '.intval($cat_array[0]);
     161    $whichcat .= ' AND (category_id '.$eq.' '.intval($cat_array[0]);
    160162    for ($i = 1; $i < (count($cat_array)); $i = $i + 1) {
    161163        $whichcat .= ' '.$andor.' post_category '.$eq.' '.intval($cat_array[$i]);
    162164    }
    163165    $whichcat .= ')';
    164 }
     166}
     167
     168// Category stuff for nice URIs
     169
     170if ('' != $category_name) {
     171    $category_name = preg_replace('|[^a-z0-9-/]|', '', $category_name);
     172    $join = " LEFT JOIN $tablepost2cat ON ($tableposts.ID = $tablepost2cat.post_id) LEFT JOIN $tablecategories ON ($tablepost2cat.category_id = $tablecategories.cat_ID) ";
     173    $whichcat = " AND (category_nicename = '$category_name') ";
     174}
     175
    165176// author stuff
    166177if ((empty($author)) || ($author == 'all') || ($author == '0')) {
     
    294305else
    295306    $where .= ')';
    296 $request = " SELECT $distinct * FROM $tableposts WHERE 1=1".$where." ORDER BY post_$orderby $limits";
     307$request = " SELECT $distinct * FROM $tableposts $join WHERE 1=1".$where." ORDER BY post_$orderby $limits";
    297308
    298309
Note: See TracChangeset for help on using the changeset viewer.