- Timestamp:
- Apr 6, 2009, 6:29:42 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-content/themes/xpress_default/blocks/popular_posts_block_theme.php
r157 r158 26 26 $selected_author_id = xpress_selected_author_id(false); 27 27 28 global $wpdb,$wp_query ;28 global $wpdb,$wp_query,$xoops_db; 29 29 30 30 $db_prefix = get_wp_prefix(); … … 43 43 include ($mydirpath . '/wp-includes/version.php'); 44 44 45 $select = "SELECT $view_tb.post_views, $post_tb.ID, $post_tb.post_title, $post_tb.post_date , $user_tb.display_name";46 if ($wp_db_version >= 6124){ 47 $from = " FROM ((( (";45 $select = "SELECT $view_tb.post_views, $post_tb.ID, $post_tb.post_title, $post_tb.post_date"; 46 47 $from = " FROM ((("; 48 48 $from .= " $post_tb LEFT JOIN $view_tb ON $post_tb.ID = $view_tb.post_id)"; 49 49 $from .= " INNER JOIN $term_relationships_tb ON $post_tb.ID = $term_relationships_tb.object_id)"; 50 50 $from .= " INNER JOIN $term_taxonomy ON $term_relationships_tb.term_taxonomy_id = $term_taxonomy.term_taxonomy_id)"; 51 $from .= " INNER JOIN $terms_tb ON $term_taxonomy.term_id = $terms_tb.term_id)"; 52 $from .= " INNER JOIN $user_tb ON $post_tb.post_author = $user_tb.ID"; 51 $from .= " INNER JOIN $terms_tb ON $term_taxonomy.term_id = $terms_tb.term_id "; 53 52 54 $where = " WHERE ($post_tb.post_type = 'post') AND ($post_tb.post_status = 'publish')"; 55 if (!empty($selected_author_id)){ 56 $where .= " AND $post_tb.post_author = $selected_author_id "; 57 } 53 $where = " WHERE $post_tb.post_type = 'post' AND $post_tb.post_status = 'publish'"; 54 // if (!empty($selected_author_id)){ 55 // $where .= " AND ($post_tb.post_author = $selected_author_id) "; 56 // $where .= " AND ($post_tb.post_author = 2) "; 57 // } 58 58 59 59 if ($cat_select) { … … 67 67 } 68 68 69 } else { 70 $from = " FROM (("; 71 $from .= " $post_tb LEFT JOIN $view_tb ON $post_tb.ID = $view_tb.post_id)"; 72 $from .= " LEFT JOIN $post2cat_tb ON $post_tb.ID = $post2cat_tb.post_id)"; 73 $from .= " INNER JOIN $user_tb ON $post_tb.post_author = $user_tb.ID"; 74 75 $where = " WHERE ($post_tb.post_status = 'publish') AND (UNIX_TIMESTAMP($post_tb.post_date) <= UNIX_TIMESTAMP())" ; 76 77 if ($cat_select) { 78 $where .= " AND ($post2cat_tb.category_id IN ($cat_id))"; 79 } 80 if (!empty($selected_author_id)){ 81 $where .= " AND $post_tb.post_author = $selected_author_id "; 82 } 83 84 } 69 85 70 if ($show_month_range > 0) { 86 71 $where .= " AND (UNIX_TIMESTAMP($post_tb.post_date) >= UNIX_TIMESTAMP(DATE_ADD(CURRENT_DATE, INTERVAL -$show_month_range month)))"; 87 72 } 88 73 $order_limmit = " GROUP BY $post_tb.ID ORDER BY $view_tb.post_views DESC LIMIT 0, $disp_count"; 89 90 $populars = $wpdb->get_results($select . $from . $where . $order_limmit); 74 $sql = $select . $from . $where . $order_limmit; 75 76 $populars = $wpdb->get_results($sql); 91 77 92 78 foreach ($populars as $popular){ … … 156 142 $post_modified_date_time = $post_modified_date . ' ' . $post_modified_time ; 157 143 $trackback_url = trackback_url(false); 158 $post_viwes = xpress_post_views_count($post_id, 'views: %d',false);144 $post_viwes = xpress_post_views_count($post_id,__('views: %d','xpress') ,false); 159 145 // if (empty($tags)) $tags = __('Not Tag'); 160 146
Note: See TracChangeset
for help on using the changeset viewer.