rendered paste body<?php
/*
Plugin Name: DC nicer archive.
Plugin URI: http://www.davidsaccess.com/
Description: Functions for creating "nicer archives" type page. Requires chnges to the default theme.
Version: 1.1
Author: David Clark
Author URI: http://www.davidsaccess.com/
*/
function is_full () {
$url_var = $_GET['full'] ;
// If it's empty, return.
if (empty($url_var))
{return false;}
else {return true;}
}
function cat_header_link() {
global $posts, $post;
if (!is_full() && (count($posts) > 0)) {
$output = ' ('.count($posts).') <a href="'.get_category_link($post->post_category) .'&full=1" rel="bookmark" title="Permanent Link: '.$category_name. '">Expand</a>';}
elseif (count($posts) > 0) {$output = ' ('.count($posts).') <a href="'.get_category_link($post->post_category) .'" rel="bookmark" title="Permanent Link: '.$category_name. '">Collapse</a>';}
else {$output = $category_name.' ('.count($posts).')';}
return $output;
}
function mo_header_link($before='', $after='') {
global $orderby, $m, $posts;
$post = $posts[0];
if (!is_full()) {$output = ' ('.count($posts).') <a href="'.get_month_link(mysql2date("Y",$post->post_date), mysql2date("m",$post->post_date)) .'?full=1">Expand </a> ';}
else {$output = ' ('.count($posts).') <a href="'.get_month_link(mysql2date("Y",$post->post_date), mysql2date("m",$post->post_date)) .'?full=0">Collapse </a> ';}
return $output;
}
function search_header_link($before='', $after='') {
global $posts, $post, $wpdb, $month, $previous, $category_no;
$query_var = 's='.$_GET['s'];
if ($_GET['sentence']) {$sentence = '&sentence=1';}
if (!is_full() && (count($posts) > 0)) {
$output = $query_name.' ('.count($posts).') <a href="'.get_settings('siteurl').'/index.php?'.$query_var.'&full=1'.$sentence.'" rel="bookmark" title="Full search results">Expand</a>';}
elseif (count($posts) > 0) {$output = $query_name.' ('.count($posts).') <a href="'.get_settings('siteurl').'/index.php?'.$query_var.$sentence.'" rel="bookmark" title="Search results">Collapse</a>';}
return $output;
}
function order_query($query_va) {
if (!empty($query_string) && ($query_string['feed'] == '') && !is_admin()) {
$query_string .= '&orderby=title&order=asc&posts_per_page=999';
}
return $query_string;
}
add_filter('query_string', 'order_query',1);
?>