WordPress Related Posts - Version 1.2.1

Version Description

  • Sane defaults
Download this release

Release Info

Developer andraz
Plugin Icon wp plugin WordPress Related Posts
Version 1.2.1
Comparing to
See all releases

Code changes from version 1.2 to 1.2.1

Files changed (2) hide show
  1. readme.txt +5 -3
  2. wp_related_posts.php +37 -4
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: denishua
3
  Tags: Related,Posts
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8490579
5
  Requires at least: 2.3
6
- Tested up to: 2.8.4
7
- Stable tag: 1.2
8
 
9
  WordPress Related Posts Plugin will generate a related posts via WordPress tags, and add the related posts to feed.
10
 
@@ -18,7 +18,6 @@ Please search and submit your transaltion here: <a href="http://fairyfish.net/20
18
 
19
  1. Upload the folder WPRP to the `/wp-content/plugins/` directory
20
  1. Activate the plugin through the 'Plugins' menu in WordPress
21
- 1. Place `<?php wp_related_posts(); ?>` in your templates
22
  1. Navigate to Manage > Option > WordPress Related Posts to configure plugin output.
23
 
24
  == Screenshots ==
@@ -27,6 +26,9 @@ Please search and submit your transaltion here: <a href="http://fairyfish.net/20
27
 
28
  == Changelog ==
29
 
 
 
 
30
  = 1.2 =
31
  * Compatible with WordPress 3.0
32
 
3
  Tags: Related,Posts
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8490579
5
  Requires at least: 2.3
6
+ Tested up to: 3.4.1
7
+ Stable tag: 1.2.1
8
 
9
  WordPress Related Posts Plugin will generate a related posts via WordPress tags, and add the related posts to feed.
10
 
18
 
19
  1. Upload the folder WPRP to the `/wp-content/plugins/` directory
20
  1. Activate the plugin through the 'Plugins' menu in WordPress
 
21
  1. Navigate to Manage > Option > WordPress Related Posts to configure plugin output.
22
 
23
  == Screenshots ==
26
 
27
  == Changelog ==
28
 
29
+ = 1.2.1 =
30
+ * Sane defaults
31
+
32
  = 1.2 =
33
  * Compatible with WordPress 3.0
34
 
wp_related_posts.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  Plugin Name: WordPress Related Posts
4
- Version: 1.2
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
@@ -13,6 +13,34 @@ function init_textdomain(){
13
  load_plugin_textdomain('wp_related_posts',PLUGINDIR . '/' . dirname(plugin_basename (__FILE__)) . '/lang');
14
  }
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  function wp_get_related_posts($before_title="",$after_title="") {
17
  global $wpdb, $post;
18
  $wp_rp = get_option("wp_rp");
@@ -121,7 +149,8 @@ function wp_get_related_posts($before_title="",$after_title="") {
121
  if($before_title){
122
  if($wp_rp_title != '') $output = $before_title.$wp_rp_title .$after_title. $output;
123
  }else{
124
- if(!$wp_rp_title_tag) $wp_rp_title_tag ='h3';
 
125
  if($wp_rp_title != '') $output = '<'.$wp_rp_title_tag.' class="related_post_title">'.$wp_rp_title .'</'.$wp_rp_title_tag.'>'. $output;
126
  }
127
 
@@ -349,6 +378,10 @@ function wp_related_posts_options_subpanel() {
349
  <select name="wp_rp_title_tag_option" id="wp_rp_title_tag" class="postform">
350
  <?php
351
  $wp_rp_title_tag_array = array('h2','h3','h4','p','div');
 
 
 
 
352
  foreach ($wp_rp_title_tag_array as $wp_rp_title_tag_a){
353
  ?>
354
  <option value="<?php echo $wp_rp_title_tag_a; ?>" <?php if($wp_rp_title_tag == $wp_rp_title_tag_a) echo 'selected' ?> >&lt;<?php echo $wp_rp_title_tag_a; ?>&gt;</option>
@@ -395,11 +428,11 @@ function wp_related_posts_options_subpanel() {
395
  </td>
396
  </tr>
397
  <tr valign="top">
398
- <th scope="row"><label for="wp_rp_except"><?php _e("Except Setting:",'wp_related_posts'); ?></label></th>
399
  <td>
400
  <label>
401
  <input name="wp_rp_except_option" type="checkbox" id="wp_rp_except" value="yes" <?php echo ($wp_rp["wp_rp_except"] == 'yes') ? 'checked' : ''; ?> onclick="wp_rp_except_onclick();" >
402
- <?php _e("Display Post Except?",'wp_related_posts');?>
403
  </label>
404
  <br />
405
  <label id="wp_rp_except_number_label" style="<?php echo ($wp_rp["wp_rp_except"] == 'yes') ? '' : 'display:none;'; ?>">
1
  <?php
2
  /*
3
  Plugin Name: WordPress Related Posts
4
+ Version: 1.2.1
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
13
  load_plugin_textdomain('wp_related_posts',PLUGINDIR . '/' . dirname(plugin_basename (__FILE__)) . '/lang');
14
  }
15
 
16
+ register_activation_hook( __FILE__, 'activate_wp_related_posts' );
17
+ function activate_wp_related_posts() {
18
+ $wp_rp = get_option("wp_rp");
19
+ if (!isset($wp_rp['wp_rp_auto'])) {
20
+ $wp_rp['wp_rp_auto'] = 'yes';
21
+ }
22
+ if (!isset($wp_rp['wp_rp_title'])) {
23
+ $wp_rp['wp_rp_title'] = 'Related posts';
24
+ }
25
+ if (!isset($wp_rp['wp_rp_limit'])) {
26
+ $wp_rp['wp_rp_limit'] = 5;
27
+ }
28
+ if (!isset($wp_rp['wp_rp_rss'])) {
29
+ $wp_rp['wp_rp_rss'] = true;
30
+ }
31
+ if (!isset($wp_rp['wp_no_rp'])) {
32
+ $wp_rp['wp_no_rp'] = 'random';
33
+ if (!isset($wp_rp['wp_no_rp_text'])) {
34
+ $wp_rp['wp_no_rp_text'] = 'Random posts';
35
+ }
36
+ }
37
+ update_option( "wp_rp", $wp_rp );
38
+
39
+ }
40
+
41
+ global $WP_RP_TITLE_TAG_DEFAULT;
42
+ $WP_RP_TITLE_TAG_DEFAULT = 'h3';
43
+
44
  function wp_get_related_posts($before_title="",$after_title="") {
45
  global $wpdb, $post;
46
  $wp_rp = get_option("wp_rp");
149
  if($before_title){
150
  if($wp_rp_title != '') $output = $before_title.$wp_rp_title .$after_title. $output;
151
  }else{
152
+ global $WP_RP_TITLE_TAG_DEFAULT;
153
+ if(!$wp_rp_title_tag) $wp_rp_title_tag = $WP_RP_TITLE_TAG_DEFAULT;
154
  if($wp_rp_title != '') $output = '<'.$wp_rp_title_tag.' class="related_post_title">'.$wp_rp_title .'</'.$wp_rp_title_tag.'>'. $output;
155
  }
156
 
378
  <select name="wp_rp_title_tag_option" id="wp_rp_title_tag" class="postform">
379
  <?php
380
  $wp_rp_title_tag_array = array('h2','h3','h4','p','div');
381
+ if (!isset($wp_rp_title_tag) || $wp_rp_title_tag == 0 ) {
382
+ global $WP_RP_TITLE_TAG_DEFAULT;
383
+ $wp_rp_title_tag = $WP_RP_TITLE_TAG_DEFAULT;
384
+ }
385
  foreach ($wp_rp_title_tag_array as $wp_rp_title_tag_a){
386
  ?>
387
  <option value="<?php echo $wp_rp_title_tag_a; ?>" <?php if($wp_rp_title_tag == $wp_rp_title_tag_a) echo 'selected' ?> >&lt;<?php echo $wp_rp_title_tag_a; ?>&gt;</option>
428
  </td>
429
  </tr>
430
  <tr valign="top">
431
+ <th scope="row"><label for="wp_rp_except"><?php _e("Excerpt Setting:",'wp_related_posts'); ?></label></th>
432
  <td>
433
  <label>
434
  <input name="wp_rp_except_option" type="checkbox" id="wp_rp_except" value="yes" <?php echo ($wp_rp["wp_rp_except"] == 'yes') ? 'checked' : ''; ?> onclick="wp_rp_except_onclick();" >
435
+ <?php _e("Display Post Excerpt?",'wp_related_posts');?>
436
  </label>
437
  <br />
438
  <label id="wp_rp_except_number_label" style="<?php echo ($wp_rp["wp_rp_except"] == 'yes') ? '' : 'display:none;'; ?>">