WordPress Related Posts - Version 1.0

Version Description

Download this release

Release Info

Developer denishua
Plugin Icon wp plugin WordPress Related Posts
Version 1.0
Comparing to
See all releases

Code changes from version 0.9 to 1.0

Files changed (2) hide show
  1. readme.txt +2 -2
  2. wp_related_posts.php +2 -25
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: denishua
3
  Tags: Related,Posts
4
  Donate link: http://fairyfish.net/donate/
5
  Requires at least: 2.3
6
- Tested up to: 2.5
7
- Stable tag: 0.9
8
 
9
  WordPress Related Posts Plugin will generate a related posts via WordPress tags, and add the related posts to feed.
10
 
3
  Tags: Related,Posts
4
  Donate link: http://fairyfish.net/donate/
5
  Requires at least: 2.3
6
+ Tested up to: 2.6.2
7
+ Stable tag: 1.0
8
 
9
  WordPress Related Posts Plugin will generate a related posts via WordPress tags, and add the related posts to feed.
10
 
wp_related_posts.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  Plugin Name: WordPress Related Posts
4
- Version: 0.9
5
  Plugin URI: http://fairyfish.net/2007/09/12/wordpress-23-related-posts-plugin/
6
  Description: Generate a related posts list via tags of WordPress
7
  Author: Denis
@@ -80,7 +80,7 @@ function wp_get_related_posts() {
80
  $limitclause = "LIMIT 10";
81
  }
82
 
83
- $q = "SELECT DISTINCT p.ID, p.post_title, p.post_date, p.comment_count, count(t_r.object_id) as cnt FROM $wpdb->term_taxonomy t_t, $wpdb->term_relationships t_r, $wpdb->posts p WHERE t_t.taxonomy ='post_tag' AND t_t.term_taxonomy_id = t_r.term_taxonomy_id AND t_r.object_id = p.ID AND (t_t.term_id IN ($taglist)) AND p.ID != $post->ID AND p.post_status = 'publish' AND p.post_date_gmt < '$now' GROUP BY t_r.object_id ORDER BY cnt DESC, p.post_date_gmt DESC $limitclause;";
84
 
85
  //echo $q;
86
 
@@ -136,31 +136,8 @@ function wp_get_related_posts() {
136
  }
137
 
138
  function wp_related_posts(){
139
-
140
- global $id;
141
-
142
- $preview = $_GET['preview'];
143
-
144
- $output_old = get_post_meta($id, "related_posts", $single = true);
145
-
146
- if($output_old){
147
- $time = time();
148
- if(($time - $output_old["time"])<600){
149
- echo $output_old["related_posts"];
150
- return;
151
- }
152
- }
153
 
154
  $output = wp_get_related_posts() ;
155
-
156
- $output_new = array("time"=>time(),"related_posts"=>$output);
157
- if($output_old){
158
- update_post_meta($id, 'related_posts', $output_new);
159
- }else{
160
- if(!add_post_meta($id, 'related_posts', $output_new, true)){
161
- update_post_meta($id, 'related_posts', $output_new);
162
- }
163
- }
164
 
165
  echo $output;
166
  }
1
  <?php
2
  /*
3
  Plugin Name: WordPress Related Posts
4
+ Version: 1.0
5
  Plugin URI: http://fairyfish.net/2007/09/12/wordpress-23-related-posts-plugin/
6
  Description: Generate a related posts list via tags of WordPress
7
  Author: Denis
80
  $limitclause = "LIMIT 10";
81
  }
82
 
83
+ $q = "SELECT p.ID, p.post_title, p.post_date, p.comment_count, count(t_r.object_id) as cnt FROM $wpdb->term_taxonomy t_t, $wpdb->term_relationships t_r, $wpdb->posts p WHERE t_t.taxonomy ='post_tag' AND t_t.term_taxonomy_id = t_r.term_taxonomy_id AND t_r.object_id = p.ID AND (t_t.term_id IN ($taglist)) AND p.ID != $post->ID AND p.post_status = 'publish' AND p.post_date_gmt < '$now' GROUP BY t_r.object_id ORDER BY cnt DESC, p.post_date_gmt DESC $limitclause;";
84
 
85
  //echo $q;
86
 
136
  }
137
 
138
  function wp_related_posts(){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
139
 
140
  $output = wp_get_related_posts() ;
 
 
 
 
 
 
 
 
 
141
 
142
  echo $output;
143
  }