Changeset 627949
- Timestamp:
- 11/20/2012 10:44:27 PM (13 years ago)
- Location:
- related-posts-list-grid-and-slider-all-in-one
- Files:
-
- 4 edited
-
tags/1.7/related.php (modified) (2 diffs)
-
tags/1.7/the_globals.php (modified) (1 diff)
-
trunk/related.php (modified) (2 diffs)
-
trunk/the_globals.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
related-posts-list-grid-and-slider-all-in-one/tags/1.7/related.php
r623759 r627949 14 14 $aio_related_posts_settings = aio_read_options(); 15 15 $rstyle = $aio_related_posts_settings['related_posts_type']; 16 //------------------------------------------------------------------------ 17 function sortTwoDimensionArrayByKey($arr, $arrKey, $sortOrder=SORT_ASC){ 18 foreach ($arr as $key => $row){ 19 $key_arr[$key] = $row[$arrKey]; 20 } 21 array_multisort($key_arr, $sortOrder, $arr); 22 return $arr; 23 } 16 24 //------------------------------------------------------------------------ 17 25 function get_related_posts_aio($content) … … 216 224 //$stuff = ''; 217 225 if ((is_int($post->ID))) { 218 $sql = "SELECT DISTINCT ID,post_title,post_date ,MATCH (post_title,post_content) AGAINST ('".$stuff."') AS score"226 $sql = "SELECT DISTINCT ID,post_title,post_date " 219 227 . "FROM ". "$wpdb->posts , $wpdb->term_taxonomy t_t, $wpdb->term_relationships t_r" 220 228 ." WHERE " 221 ." (t_t.taxonomy ='post_tag' AND t_t.term_taxonomy_id = t_r.term_taxonomy_id AND t_r.object_id = ID AND (t_t.term_id IN ($taglist)) " 222 . "or MATCH (post_title,post_content) AGAINST ('".$stuff."')) " 229 ." (t_t.taxonomy ='post_tag' AND t_t.term_taxonomy_id = t_r.term_taxonomy_id AND t_r.object_id = ID AND (t_t.term_id IN ($taglist))) " 223 230 . "AND post_date <= '".$now."' " 224 231 . "AND post_status = 'publish' " 225 232 . "AND id != ".$post->ID." " 226 233 ."AND post_type = 'post' " 227 ." order by score*id desc "234 ." order by id desc " 228 235 ."LIMIT ".$limit; 229 236 $search_counter = 0; -
related-posts-list-grid-and-slider-all-in-one/tags/1.7/the_globals.php
r613077 r627949 7 7 global $post; 8 8 $tags = wp_get_post_tags($post->ID); 9 10 $taglist = "'" . $tags[0]->term_id. "'"; 11 12 $tagcount = count($tags); 9 $tagcount = count($tags); 10 $result = $tags; 11 if ($tagcount > 1) { 12 for ($i = 0; $i < $tagcount; $i++) 13 { 14 $mytags[$i]['term_id'] = $tags[$i]->term_id; 15 $mytags[$i]['count'] = $tags[$i]->count; 16 } 17 $result = sortTwoDimensionArrayByKey($mytags,'count'); 18 } 19 $taglist = "'" . $result[0]->term_id. "'"; 20 $countlist = "'" . $result[0]->count. "'"; 21 13 22 if ($tagcount > 1) { 14 23 for ($i = 1; $i < $tagcount; $i++) { 15 $taglist = $taglist . ", '" . $tags[$i]->term_id . "'"; 24 if ($result[$i]['count'] < 9) { 25 $taglist = $taglist . ", '" . $result[$i]['term_id'] . "'"; 26 $countlist = $countlist . ", '" . $result[$i]['count'] . "'";} 16 27 } 17 28 } -
related-posts-list-grid-and-slider-all-in-one/trunk/related.php
r623759 r627949 14 14 $aio_related_posts_settings = aio_read_options(); 15 15 $rstyle = $aio_related_posts_settings['related_posts_type']; 16 //------------------------------------------------------------------------ 17 function sortTwoDimensionArrayByKey($arr, $arrKey, $sortOrder=SORT_ASC){ 18 foreach ($arr as $key => $row){ 19 $key_arr[$key] = $row[$arrKey]; 20 } 21 array_multisort($key_arr, $sortOrder, $arr); 22 return $arr; 23 } 16 24 //------------------------------------------------------------------------ 17 25 function get_related_posts_aio($content) … … 216 224 //$stuff = ''; 217 225 if ((is_int($post->ID))) { 218 $sql = "SELECT DISTINCT ID,post_title,post_date ,MATCH (post_title,post_content) AGAINST ('".$stuff."') AS score"226 $sql = "SELECT DISTINCT ID,post_title,post_date " 219 227 . "FROM ". "$wpdb->posts , $wpdb->term_taxonomy t_t, $wpdb->term_relationships t_r" 220 228 ." WHERE " 221 ." (t_t.taxonomy ='post_tag' AND t_t.term_taxonomy_id = t_r.term_taxonomy_id AND t_r.object_id = ID AND (t_t.term_id IN ($taglist)) " 222 . "or MATCH (post_title,post_content) AGAINST ('".$stuff."')) " 229 ." (t_t.taxonomy ='post_tag' AND t_t.term_taxonomy_id = t_r.term_taxonomy_id AND t_r.object_id = ID AND (t_t.term_id IN ($taglist))) " 223 230 . "AND post_date <= '".$now."' " 224 231 . "AND post_status = 'publish' " 225 232 . "AND id != ".$post->ID." " 226 233 ."AND post_type = 'post' " 227 ." order by score*id desc "234 ." order by id desc " 228 235 ."LIMIT ".$limit; 229 236 $search_counter = 0; -
related-posts-list-grid-and-slider-all-in-one/trunk/the_globals.php
r613077 r627949 7 7 global $post; 8 8 $tags = wp_get_post_tags($post->ID); 9 10 $taglist = "'" . $tags[0]->term_id. "'"; 11 12 $tagcount = count($tags); 9 $tagcount = count($tags); 10 $result = $tags; 11 if ($tagcount > 1) { 12 for ($i = 0; $i < $tagcount; $i++) 13 { 14 $mytags[$i]['term_id'] = $tags[$i]->term_id; 15 $mytags[$i]['count'] = $tags[$i]->count; 16 } 17 $result = sortTwoDimensionArrayByKey($mytags,'count'); 18 } 19 $taglist = "'" . $result[0]->term_id. "'"; 20 $countlist = "'" . $result[0]->count. "'"; 21 13 22 if ($tagcount > 1) { 14 23 for ($i = 1; $i < $tagcount; $i++) { 15 $taglist = $taglist . ", '" . $tags[$i]->term_id . "'"; 24 if ($result[$i]['count'] < 9) { 25 $taglist = $taglist . ", '" . $result[$i]['term_id'] . "'"; 26 $countlist = $countlist . ", '" . $result[$i]['count'] . "'";} 16 27 } 17 28 }
Note: See TracChangeset
for help on using the changeset viewer.