Advertisement
Guest User

Untitled

a guest
Mar 25th, 2011
282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. $currentcatobj = get_category(get_query_var('cat'),false);
  2. $currentcat = $currentcatobj->term_id;
  3.  
  4. $includecats = " AND $wpdb->posts.ID IN (
  5.  
  6. SELECT object_id
  7. FROM $wpdb->term_relationships AS r
  8. JOIN $wpdb->term_taxonomy AS x ON x.term_taxonomy_id = r.term_taxonomy_id
  9. JOIN $wpdb->terms AS t ON t.term_id = x.term_id
  10. WHERE x.taxonomy = 'category'
  11. AND object_id IN
  12. (
  13. SELECT object_id
  14. FROM $wpdb->term_relationships AS r
  15. JOIN $wpdb->term_taxonomy AS x ON x.term_taxonomy_id = r.term_taxonomy_id
  16. JOIN $wpdb->terms AS t ON t.term_id = x.term_id
  17. WHERE x.taxonomy = 'category'
  18. AND t.term_id IN (".$currentcat.")))";
  19.  
  20.  
  21.  
  22. $mostpopular = $wpdb->get_results("SELECT $wpdb->posts.ID, $wpdb->posts.post_title $fields FROM $wpdb->posts $join WHERE $wpdb->posts.post_status = 'publish' AND $wpdb->posts.post_password = '' AND $range $force_pv $nopages $exclude $includecats GROUP BY $wpdb->posts.ID ORDER BY $sortby DESC LIMIT " . $instance['limit'] . "");
  23. $cat_name = get_cat_name($currentcat);
  24. $content = "$cat_name";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement