tags to maintain CSS formatting for many sites where formatting is applied to the

tag. Also, condensed content is now applied to search pages as well. 0.92 Renamed wp_query_state class to rm_query_state_class to prevent a clash with the latest WordPress nightly and future versions 0.91 Added Ryan Boren's wp_query_state class to properly detect query states regardless of permalinks being turned on. This fixes the problem many people have with non-standard permalinks. 0.90 Initial relase */ function condensed_content($content) { // This is the text that appears after the entry is condensed $more_link_text='Continue reading »'; // Number of words to condense the entry to $cut_at = 30; ///////////////////////////////////////// // No need to change anything below this $qs = new RM_WP_Query_State; $qs->parse_query($_SERVER['QUERY_STRING']); if ($qs->archive || $qs->search) { $content = strip_tags($content); $blah = explode(' ', $content); if (count($blah) > $cut_at) { $k = $cut_at; $use_more_link_text = 1; } else { $k = count($blah); $use_more_link_text = 0; } for ($i=0; $i<$k; $i++) { $excerpt .= $blah[$i].' '; } $excerpt .= ($use_more_link_text) ? '...

'.$more_link_text.'

' : ''; $content = $excerpt; $content = str_replace(']]>', ']]>', $content); } return "

$content

"; } class RM_WP_Query_State { var $single = false; var $archive = false; var $date = false; var $author = false; var $category = false; var $search = false; var $feed = false; function init () { $this->single = false; $this->archive = false; $this->date = false; $this->author = false; $this->category = false; $this->search = false; $this->feed = false; } function parse_query ($query) { parse_str($query); $this->init(); if ('' != $m) { $this->date = true; } if ('' != $hour) { $this->date = true; } if ('' != $minute) { $this->date = true; } if ('' != $second) { $this->date = true; } if ('' != $year) { $this->date = true; } if ('' != $monthnum) { $this->date = true; } if ('' != $day) { $this->date = true; } if ('' != $w) { $this->date = true; } if ('' != $name) { $this->single = true; } if (($p != '') && ($p != 'all')) { $this->single = true; } if (!empty($s)) { $this->search = true; } if ((empty($cat)) || ($cat == 'all') || ($cat == '0') || // Bypass cat checks if fetching specific posts ( intval($year) || intval($monthnum) || intval($day) || intval($w) || intval($p) || !empty($name) || !empty($s) ) ) { $this->category = false; } else { if (stristr($cat,'-')) { $this->category = false; } else { $this->category = true; } } if ('' != $category_name) { $this->category = true; } if ((empty($author)) || ($author == 'all') || ($author == '0')) { $this->author = false; } else { $this->author = true; } if ('' != $author_name) { $this->author = true; } if ('' != $feed) { $this->feed = true; } if ( ($this->date || $this->author || $this->category) && (! $this->single)) { $this->archive = true; } } function WP_Query_State ($query = '') { if (! empty($query)) { $this->parse_query($query); } } } add_filter('the_content','condensed_content'); ?>