O.K Here’s what I Did;
if (empty($orderby)) {
$orderby=’date ‘.$order;
Which needs to be something more like the following;
if (empty($orderby)) {
$orderby=’date ‘.$order;
if (!empty($whichcat))
$where .= ‘ OR post_status = “sticky”‘;
else
$where .= ‘ OR (post_status = “sticky” AND $whichcat==7)’;
And of course, the sticky hack already requires that the line:
$where .= ‘ AND (post_status = “publish”‘;
is changed to something like:
$where .= ‘ AND (post_status = “publish”‘ OR post_status = “sticky”;
but you really want it in your case to be:
$where .= ‘ AND (post_status = “publish”‘;
if (!empty($whichcat))
$where .= ‘ OR post_status = “sticky”‘;
else
$where .= ‘ OR (post_status = “sticky” AND $whichcat==7)’;
This is the error I get:
SQL/DB Error:
[You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ‘==7) AND post_date <= ‘2004-04-25 11:26:19’ AND (post_status = ]
SELECT DISTINCT * FROM wp_posts WHERE 1=1 OR (post_status = “sticky” AND $whichcat==7) AND post_date <= ‘2004-04-25 11:26:19’ AND (post_status = “publish” OR post_status = “sticky”) ORDER BY post_status DESC, post_date DESC LIMIT 2
Kevin