sidebar…
i found post like this one, but i’m not sure;
I use the following code to generate a list of the titles of the 10 most recent post in my sidebar and exclude 1 category (with id=18 in this example):
i found this error;
WordPress database error: [Not unique table/alias: ‘wp_post2cat’]
SELECT SQL_CALC_FOUND_ROWS wp_posts.*, wp_sticky.sticky_status FROM wp_posts LEFT JOIN wp_post2cat ON (wp_posts.ID = wp_post2cat.post_id) LEFT JOIN wp_post2cat ON (wp_posts.ID = wp_post2cat.post_id) LEFT JOIN wp_sticky ON wp_sticky.sticky_post_id = wp_posts.ID WHERE 1=1 AND wp_posts.ID NOT IN (3) AND (post_type = ‘post’ AND (post_status = ‘publish’)) AND category_id NOT IN (1,2) GROUP BY wp_posts.ID ORDER BY (wp_sticky.sticky_status = 2 AND wp_sticky.sticky_status IS NOT NULL) DESC, DATE_FORMAT(wp_posts.post_date,’%Y-%m-%d’) DESC, (wp_sticky.sticky_status = 1 AND wp_sticky.sticky_status IS NULL) DESC, DATE_FORMAT(wp_posts.post_date,’%T’) DESC LIMIT 0, 10
how to exclude a few categories from recent post in the sidebar?