WordPress Related Posts - Version 2.0.2

Version Description

  • Fixed bug for post_types with no tags
Download this release

Release Info

Developer jureham
Plugin Icon wp plugin WordPress Related Posts
Version 2.0.2
Comparing to
See all releases

Code changes from version 2.0.1 to 2.0.2

Files changed (3) hide show
  1. readme.txt +4 -1
  2. recommendations.php +5 -1
  3. wp_related_posts.php +1 -1
readme.txt CHANGED
@@ -5,7 +5,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
5
  License: GPLv2
6
  Requires at least: 3.3
7
  Tested up to: 3.5
8
- Stable tag: 2.0.1
9
 
10
  WordPress Related Posts generates a list of related posts with thumbnails and gives you click-through statistics.
11
 
@@ -63,6 +63,9 @@ Yes, related posts are responsive so they adapt to the screen size to ensure max
63
 
64
  == Changelog ==
65
 
 
 
 
66
  = 2.0.1 =
67
  * Fixed bug for short_open_tag=Off
68
 
5
  License: GPLv2
6
  Requires at least: 3.3
7
  Tested up to: 3.5
8
+ Stable tag: 2.0.2
9
 
10
  WordPress Related Posts generates a list of related posts with thumbnails and gives you click-through statistics.
11
 
63
 
64
  == Changelog ==
65
 
66
+ = 2.0.2 =
67
+ * Fixed bug for post_types with no tags
68
+
69
  = 2.0.1 =
70
  * Fixed bug for short_open_tag=Off
71
 
recommendations.php CHANGED
@@ -8,6 +8,10 @@ function wp_rp_update_tags($post_id) {
8
  $post = get_post($post->post_parent);
9
  }
10
 
 
 
 
 
11
  $wpdb->query(
12
  $wpdb->prepare('DELETE from ' . $wpdb->prefix . 'wp_rp_tags WHERE post_id=%d', $post->ID)
13
  );
@@ -135,7 +139,7 @@ function wp_rp_generate_tags($post) {
135
  }
136
  }
137
 
138
- if ($post->post_status == 'publish') {
139
  $sql_tag_format_line = '(%d, %s, %f)';
140
  $tags_insert_query = $wpdb->prepare('INSERT INTO ' . $wpdb->prefix . 'wp_rp_tags (post_id, label, weight)
141
  VALUES ' . implode(', ', array_fill(0, count($all_tags), $sql_tag_format_line)) . ';',
8
  $post = get_post($post->post_parent);
9
  }
10
 
11
+ if ($post->post_type === 'nav_menu_item' || $post->post_type === 'attachment') {
12
+ return;
13
+ }
14
+
15
  $wpdb->query(
16
  $wpdb->prepare('DELETE from ' . $wpdb->prefix . 'wp_rp_tags WHERE post_id=%d', $post->ID)
17
  );
139
  }
140
  }
141
 
142
+ if (count($all_tags) > 0 && $post->post_status == 'publish') {
143
  $sql_tag_format_line = '(%d, %s, %f)';
144
  $tags_insert_query = $wpdb->prepare('INSERT INTO ' . $wpdb->prefix . 'wp_rp_tags (post_id, label, weight)
145
  VALUES ' . implode(', ', array_fill(0, count($all_tags), $sql_tag_format_line)) . ';',
wp_related_posts.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  Plugin Name: WordPress Related Posts
4
- Version: 2.0.1
5
  Plugin URI: http://wordpress.org/extend/plugins/wordpress-23-related-posts-plugin/
6
  Description: Generate a related posts list via tags of WordPress
7
  Author: Jure Ham
1
  <?php
2
  /*
3
  Plugin Name: WordPress Related Posts
4
+ Version: 2.0.2
5
  Plugin URI: http://wordpress.org/extend/plugins/wordpress-23-related-posts-plugin/
6
  Description: Generate a related posts list via tags of WordPress
7
  Author: Jure Ham