< ?php
$posts_per_page = '100';
$category_exclude = '-21';
$defaultorderby = 'post_date';
$defaultorder = 'DESC';
define('NL', "\n");
function show_year_select() {
global $wpdb, $tableposts, $m;
$m = substr($m,0,4);
$years = $wpdb->get_col(“SELECT DISTINCT YEAR(post_date) as year FROM $tableposts ORDER BY year ASC”);
$output .= ‘‘.NL;
foreach ($years as $year) {
$output .= ‘
“.$thisletter;
}
$previous = $thisletter;
} elseif (‘category’ == $orderby) {
$thiscategory = $category_name;
if ($thiscategory != $previous) {
$output .= ‘
‘.get_catname($thiscategory).’‘;
}
$previous = $thiscategory;
}
if (!empty($output)) {
$output = $before.$output.$after.NL;
echo $output;
}
}
function archive_date($format=’Y-m-d H:i:s’) {
global $post;
echo mysql2date($format, $post->post_date);
}
?>
< ?php
//Make sure categories get parsed out, they are deprecated in wp-blog-header.php
if ($_POST["orderby"] == 'category') {
global $author, $m;
$orderby = 'category';
if ($_POST["order"] == '') $order = "DESC";
else $order = $_POST["order"];
$year = '' . intval($_POST["m"]);
$m = $year;
$author = ''.intval($_POST["author"]);
if (empty($author)) {
$whichauthor='';
} else {
$author = ''.urldecode($author).'';
$author = addslashes_gpc($author);
if (stristr($author, '-')) {
$eq = '!=';
$andor = 'AND';
$author = explode('-', $author);
$author = ''.intval($author[1]);
} else {
$eq = '=';
$andor = 'OR';
}
$author_array = explode(' ', $author);
$whichauthor .= ' AND (post_author '.$eq.' '.intval($author_array[0]);
for ($i = 1; $i < (count($author_array)); $i = $i + 1) {
$whichauthor .= ' '.$andor.' post_author '.$eq.' '.intval($author_array[$i]);
}
$whichauthor .= ')';
}
// Author stuff for nice URIs
if ('' != $author_name) {
if (stristr($author_name,'/')) {
$author_name = explode('/',$author_name);
if ($author_name[count($author_name)-1]) {
$author_name = $author_name[count($author_name)-1];#no trailing slash
} else {
$author_name = $author_name[count($author_name)-2];#there was a trailling slash
}
}
$author_name = preg_replace('|[^a-z0-9-]|', '', strtolower($author_name));
$author = $wpdb->get_var(“SELECT ID FROM $tableusers WHERE user_nicename='”.$author_name.”‘”);
$whichauthor .= ‘ AND (post_author = ‘.intval($author).’)’;
}
if (!empty($year)) $where .= ‘ AND YEAR(post_date)=’ . $year;
if (!empty($whichauthor)) $where .= $whichauthor;
?>
Show Archives Sorted By:
< ?php
global $category_exclude;
$cat = $category_exclude;
if (stristr($cat,'-')) {
// Note: if we have a negative, we ignore all the positives. It must
// always mean 'everything /except/ this one'. We should be able to do
// multiple negatives but we don't :-(
$eq = '!=';
$andor = 'AND';
$cat = explode('-',$cat);
$cat = intval($cat[1]);
}
$cat_array = explode(' ',$cat);
$dogs = $wpdb->get_results(“SELECT * FROM $tablecategories WHERE cat_ID != $cat_array[0] ORDER BY cat_name $order”);
foreach ($dogs as $catt) {
$categories = $wpdb->get_results(“SELECT * FROM $tablepost2cat WHERE category_id = $catt->cat_ID”);
if ($categories) {
foreach ($categories as $post2category) {
$posts = $wpdb->get_results(“SELECT * FROM $tableposts WHERE $post2category->post_id = ID”.$where);
//$category_realname = $wpdb->get_row(“SELECT cat_name FROM $tablecategories WHERE cat_ID = $post2category->category_id”);
//print_r($category_realname);
global $category_name;
$category_name = $post2category->category_id;
if ($posts) {
foreach ($posts as $post) {
start_wp();
archive_header(‘
‘, ‘
- ‘);
archive_date(‘m-d-Y h:iA’) ?>:
Show Archives Sorted By:
< ?php if ($posts) { foreach ($posts as $post) { start_wp(); ?>
< ?php //print_r($post); ?>
< ?php archive_header('
‘, ‘
- ‘) ?>
< ?php archive_date('m-d-Y h:iA') ?>: Post Title: The Daily Render Sort
Posted in:
No comments yet.
+ RSS feed for comments on this post.
Sorry, the comment form is closed at this time.
©2004-2026 Nikolas R. Schiller - Former Colonist of the District of Columbia - Privacy Policy - Fair Use - RSS - Contact














