Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Mar 25th, 2011  |  syntax: None  |  size: 1.09 KB  |  views: 206  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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";
clone this paste RAW Paste Data