Related Posts Thumbnails Plugin for WordPress - Version 1.3.1

Version Description

  • backwards compatibility with WP 2.9
Download this release

Release Info

Developer marynixie
Plugin Icon 128x128 Related Posts Thumbnails Plugin for WordPress
Version 1.3.1
Comparing to
See all releases

Code changes from version 1.3 to 1.3.1

Files changed (2) hide show
  1. readme.txt +5 -2
  2. related-posts-thumbnails.php +24 -8
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: marynixie
3
  Donate link: http://wordpress.shaldybina.com/donate
4
  Tags: related, posts, thumbnail
5
  Requires at least: 2.9
6
- Tested up to: 3.1.2
7
- Stable tag: 1.3
8
 
9
  Customizable plugin, that nicely displays related posts thumbnails under the post.
10
 
@@ -61,6 +61,9 @@ If there are no images of the specified size in the post, or file does not exist
61
 
62
  == Changelog ==
63
 
 
 
 
64
  = 1.3 =
65
  * Added support of custom post types and custom taxonomies
66
  * Added multibyte strings support
3
  Donate link: http://wordpress.shaldybina.com/donate
4
  Tags: related, posts, thumbnail
5
  Requires at least: 2.9
6
+ Tested up to: 3.2.1
7
+ Stable tag: 1.3.1
8
 
9
  Customizable plugin, that nicely displays related posts thumbnails under the post.
10
 
61
 
62
  == Changelog ==
63
 
64
+ = 1.3.1 =
65
+ * backwards compatibility with WP 2.9
66
+
67
  = 1.3 =
68
  * Added support of custom post types and custom taxonomies
69
  * Added multibyte strings support
related-posts-thumbnails.php CHANGED
@@ -2,7 +2,7 @@
2
  Plugin Name: Related Posts Thumbnails
3
  Plugin URI: http://wordpress.shaldybina.com/plugins/related-posts-thumbnails/
4
  Description: Showing related posts thumbnails under the post.
5
- Version: 1.3
6
  Author: Maria Shaldybina
7
  Author URI: http://shaldybina.com/
8
  */
@@ -25,7 +25,7 @@ class RelatedPostsThumbnails {
25
  var $top_text = '<h3>Related posts:</h3>';
26
  var $number = 3;
27
  var $relation = 'categories';
28
- var $poststh_name = 'thumbnail';
29
  var $background = '#FFFFFF';
30
  var $hoverbackground = '#EEEEEF';
31
  var $border_color = '#DDDDDD';
@@ -52,6 +52,7 @@ class RelatedPostsThumbnails {
52
  add_filter( 'the_content', array( $this, 'auto_show' ) );
53
  add_action( 'admin_menu', array( $this, 'admin_menu' ) );
54
  add_shortcode( 'related-posts-thumbnails' , array( $this, 'get_html' ) );
 
55
  }
56
 
57
  function auto_show( $content ) { // Automatically displaying related posts under post body
@@ -398,7 +399,7 @@ class RelatedPostsThumbnails {
398
  }
399
 
400
  function admin_interface() { // Admin interface
401
- if ( $_POST['action'] == 'update' ) {
402
  if ( !current_user_can( 'manage_options' ) ) {
403
  wp_die( __( 'No access', 'related-posts-thumbnails' ) );
404
  }
@@ -475,12 +476,28 @@ class RelatedPostsThumbnails {
475
  $relpoststh_output_style = get_option( 'relpoststh_output_style', $this->output_style );
476
  $thsources = array( 'post-thumbnails' => __('Post thumbnails', 'related_posts_thumbnails'), 'custom-field' => __('Custom field', 'related_posts_thumbnails') );
477
  $categories = get_categories();
478
- $post_types = get_post_types( array( 'public' => 1 ) );
 
 
 
 
 
 
 
479
  $relpoststh_post_types = get_option( 'relpoststh_post_types', $this->post_types );
480
  $output_styles = array('div' => __( 'Blocks', 'related-posts-thumbnails' ), 'list' => __( 'List', 'related-posts-thumbnails' ) );
481
  $relation_options = array('categories' => __('Categories', 'related-posts-thumbnails'), 'tags' => __('Tags', 'related-posts-thumbnails'), 'both' => __('Categories and Tags', 'related-posts-thumbnails'), 'no' => __('Random', 'related-posts-thumbnails'), 'custom' => __('Custom', 'related-posts-thumbnails') );
482
- $custom_taxonomies = get_taxonomies( array('public' => 1) );
483
- $relpoststh_custom_taxonomies = get_option( 'relpoststh_custom_taxonomies', $this->custom_taxonomies );
 
 
 
 
 
 
 
 
 
484
  ?>
485
  <script type="text/javascript">
486
  jQuery(document).ready(function($) {
@@ -577,8 +594,7 @@ class RelatedPostsThumbnails {
577
  <tr>
578
  <th scope="row"><?php _e( 'Include only posts after', 'related-posts-thumbnails' ); ?>:</th>
579
  <td>
580
- <?php _e( 'Year', 'related-posts-thumbnails' ); ?>: <input type="text" name="relpoststh_year" size="4" value="<?php echo $relpoststh_startdate[0]; ?>"> <?php _e( 'Month', 'related-posts-thumbnails' ); ?>: <input type="text" name="relpoststh_month" size="2" value="<?php echo $relpoststh_startdate[1]; ?>"> <?php _e( 'Day', 'related-posts-thumbnails' ); ?>: <input type="text" name="relpoststh_day" size="2" value="<?php echo $relpoststh_startdate[2]; ?>"> <label for="relpoststh_excerptlength"><?php _e( 'Leave empty for all posts dates', 'related-posts-thumbnails' ); ?></label><br />
581
-
582
  </td>
583
  </tr>
584
  <tr>
2
  Plugin Name: Related Posts Thumbnails
3
  Plugin URI: http://wordpress.shaldybina.com/plugins/related-posts-thumbnails/
4
  Description: Showing related posts thumbnails under the post.
5
+ Version: 1.3.1
6
  Author: Maria Shaldybina
7
  Author URI: http://shaldybina.com/
8
  */
25
  var $top_text = '<h3>Related posts:</h3>';
26
  var $number = 3;
27
  var $relation = 'categories';
28
+ var $poststhname = 'thumbnail';
29
  var $background = '#FFFFFF';
30
  var $hoverbackground = '#EEEEEF';
31
  var $border_color = '#DDDDDD';
52
  add_filter( 'the_content', array( $this, 'auto_show' ) );
53
  add_action( 'admin_menu', array( $this, 'admin_menu' ) );
54
  add_shortcode( 'related-posts-thumbnails' , array( $this, 'get_html' ) );
55
+ $this->wp_version = get_bloginfo('version');
56
  }
57
 
58
  function auto_show( $content ) { // Automatically displaying related posts under post body
399
  }
400
 
401
  function admin_interface() { // Admin interface
402
+ if ( isset($_POST['action']) && ($_POST['action'] == 'update') ) {
403
  if ( !current_user_can( 'manage_options' ) ) {
404
  wp_die( __( 'No access', 'related-posts-thumbnails' ) );
405
  }
476
  $relpoststh_output_style = get_option( 'relpoststh_output_style', $this->output_style );
477
  $thsources = array( 'post-thumbnails' => __('Post thumbnails', 'related_posts_thumbnails'), 'custom-field' => __('Custom field', 'related_posts_thumbnails') );
478
  $categories = get_categories();
479
+ if ($this->wp_version >= 3)
480
+ {
481
+ $post_types = get_post_types( array( 'public' => 1 ) );
482
+ }
483
+ else
484
+ {
485
+ $post_types = get_post_types();
486
+ }
487
  $relpoststh_post_types = get_option( 'relpoststh_post_types', $this->post_types );
488
  $output_styles = array('div' => __( 'Blocks', 'related-posts-thumbnails' ), 'list' => __( 'List', 'related-posts-thumbnails' ) );
489
  $relation_options = array('categories' => __('Categories', 'related-posts-thumbnails'), 'tags' => __('Tags', 'related-posts-thumbnails'), 'both' => __('Categories and Tags', 'related-posts-thumbnails'), 'no' => __('Random', 'related-posts-thumbnails'), 'custom' => __('Custom', 'related-posts-thumbnails') );
490
+ if ($this->wp_version >= 3)
491
+ {
492
+ $custom_taxonomies = get_taxonomies( array('public' => 1) );
493
+ $relpoststh_custom_taxonomies = get_option( 'relpoststh_custom_taxonomies', $this->custom_taxonomies );
494
+ if (!is_array($relpoststh_custom_taxonomies))
495
+ $relpoststh_custom_taxonomies = array();
496
+ }
497
+ else
498
+ {
499
+ $relation_options['custom'] .= ' '. __('(This option is available for WP v3+ only)', 'related_posts_thumbnails');
500
+ }
501
  ?>
502
  <script type="text/javascript">
503
  jQuery(document).ready(function($) {
594
  <tr>
595
  <th scope="row"><?php _e( 'Include only posts after', 'related-posts-thumbnails' ); ?>:</th>
596
  <td>
597
+ <?php _e( 'Year', 'related-posts-thumbnails' ); ?>: <input type="text" name="relpoststh_year" size="4" value="<?php if (isset($relpoststh_startdate[0])) echo $relpoststh_startdate[0]; ?>"> <?php _e( 'Month', 'related-posts-thumbnails' ); ?>: <input type="text" name="relpoststh_month" size="2" value="<?php if (isset($relpoststh_startdate[1])) echo $relpoststh_startdate[1]; ?>"> <?php _e( 'Day', 'related-posts-thumbnails' ); ?>: <input type="text" name="relpoststh_day" size="2" value="<?php if (isset($relpoststh_startdate[2])) echo $relpoststh_startdate[2]; ?>"> <label for="relpoststh_excerptlength"><?php _e( 'Leave empty for all posts dates', 'related-posts-thumbnails' ); ?></label><br />
 
598
  </td>
599
  </tr>
600
  <tr>