I was hoping to find a way to display all of my quotes but listing them by author instead of by quote. To solve the problem I made a patch that creates a new shortcode option [quote|allbyauthor]
I have tested the code and have it working on my site if you want to check it out here: http://www.rockerssoft.org/brockers/vault-quotes
Here is the patch:
--- quotes-collection/quotes-collection.php 2010-12-02 22:52:35.000000000 -0600
+++ quotes-collection-new/quotes-collection.php 2011-03-17 10:15:22.510093789 -0500
@@ -801,9 +801,12 @@
if(!$source) {
$sql .= "ORDER BY quote";
}
- else if($source == "Anonymous" || $source == "anonymous") {
+ elseif($source == "Anonymous" || $source == "anonymous") {
$sql .= "AND (author IS NULL OR author = '' OR author ='Anonymous')";
}
+ elseif($source == "ALLBYAUTHORS") {
+ $sql .= "ORDER BY author";
+ }
else {
$sql .= "AND (source = '{$source}' OR author = '{$source}')";
}
@@ -877,6 +880,10 @@
if ($start !== FALSE) {
$text = preg_replace( "/\[quote\|all\]/ie", "quotescollection_displayquotes()", $text );
}
+ $start = strpos($text,"[quote|allbyauthor]");
+ if ($start !== FALSE) {
+ $text = preg_replace( "/\[quote\|allbyauthor\]/ie", "quotescollection_displayquotes(\"ALLBYAUTHORS\")", $text );
+ }
$start = strpos($text,"[quote|author=");
if($start !== FALSE) {
$text = preg_replace("/\[quote\|author=(.{1,})?\]/ie", "quotescollection_displayquotes(\"\\1\")", $text);
@@ -888,7 +895,8 @@
$start = strpos($text,"[quote|tags=");
if($start !== FALSE) {
$text = preg_replace("/\[quote\|tags=(.{1,})?\]/ie", "quotescollection_displayquotes_tags(\"\\1\")", $text);
- } return $text;
+ }
+ return $text;
}
function quotescollection_css_head()
or you can download the patch here: http://www.rockerssoft.org/brockers/Documents/allbyauthor.patch
Hopefully someone else will find this useful. Quotes Collection is one WP plugin I simply cannot live without.
Thanks again SriniG!!
Bobby