Yet Another Related Posts Plugin (YARPP) - Version 4.0.1

Version Description

  • Improvements to thumbnail handling
    • See new FAQ entry for practical details
    • Thumbnail size can be specified programmatically (see FAQ)
    • YARPP now registers its thumbnail size properly as yarpp-thumbnail
    • Fixed a typo and simplified an item in the dynamic styles-thumbnails.php styles
    • Code to generate thumbnails of appropriate size on the fly has been added, but is turned off by default for performance reasons (see FAQ)
  • Bugfix: a class of yarpp-related- with a stray hyphen was sometimes being produced. Now fixed so it produces yarpp-related.
  • Bugfix: term_relationships table was being joined when unnecessary
  • Bugfix: widget options would not display if custom templates were not available
  • Bugfix: some transients expired too soon if object caching was used
  • The yarpp_map_post_types filter now also applies to feeds and takes an extra argument to know whether the context is website or rss.
Download this release

Release Info

Developer mitchoyoshitaka
Plugin Icon 128x128 Yet Another Related Posts Plugin (YARPP)
Version 4.0.1
Comparing to
See all releases

Code changes from version 4.0.1b3 to 4.0.1

Files changed (4) hide show
  1. class-core.php +7 -3
  2. readme.txt +26 -9
  3. template-thumbnails.php +1 -1
  4. yarpp.php +2 -2
class-core.php CHANGED
@@ -122,7 +122,6 @@ class YARPP {
122
'auto_display_archive' => false, // new in 4
123
'auto_display_post_types' => array( 'post' ), // new in 4, replacing auto_display
124
'pools' => array( 'message' => mt_rand(0,5) ), // new in 4
125
- 'generate_thumbnails' => false, // new in 4.0.1
126
);
127
}
128
@@ -293,6 +292,10 @@ class YARPP {
293
return $this->cache->cache_status() > 0.1 && $avg > 2;
294
}
295
296
function thumbnail_size() {
297
global $_wp_additional_image_sizes;
298
if ( !isset($_wp_additional_image_sizes['yarpp-thumbnail']) )
@@ -650,7 +653,8 @@ class YARPP {
650
'fulltext_indices' => $this->diagnostic_fulltext_indices(),
651
'hidden_metaboxes' => $this->diagnostic_hidden_metaboxes(),
652
'post_thumbnails' => $this->diagnostic_post_thumbnails(),
653
- 'happy' => $this->diagnostic_happy()
654
),
655
'stats' => array(
656
'counts' => array(),
@@ -1133,7 +1137,7 @@ class YARPP {
1133
if ( $this->get_transient( 'yarpp_optin' ) )
1134
return true;
1135
1136
- $remote = wp_remote_post( 'http://yarpp.org/optin/1/', array( 'body' => $this->optin_data() ) );
1137
if ( is_wp_error($remote) || !isset($remote['body']) || $remote['body'] != 'ok' ) {
1138
// try again later
1139
$this->set_transient( 'yarpp_optin', null, 60 * 60 );
122
'auto_display_archive' => false, // new in 4
123
'auto_display_post_types' => array( 'post' ), // new in 4, replacing auto_display
124
'pools' => array( 'message' => mt_rand(0,5) ), // new in 4
125
);
126
}
127
292
return $this->cache->cache_status() > 0.1 && $avg > 2;
293
}
294
295
+ function diagnostic_generate_thumbnails() {
296
+ return defined('YARPP_GENERATE_THUMBNAILS') && YARPP_GENERATE_THUMBNAILS;
297
+ }
298
+
299
function thumbnail_size() {
300
global $_wp_additional_image_sizes;
301
if ( !isset($_wp_additional_image_sizes['yarpp-thumbnail']) )
653
'fulltext_indices' => $this->diagnostic_fulltext_indices(),
654
'hidden_metaboxes' => $this->diagnostic_hidden_metaboxes(),
655
'post_thumbnails' => $this->diagnostic_post_thumbnails(),
656
+ 'happy' => $this->diagnostic_happy(),
657
+ 'generate_thumbnails' => $this->diagnostic_generate_thumbnails()
658
),
659
'stats' => array(
660
'counts' => array(),
1137
if ( $this->get_transient( 'yarpp_optin' ) )
1138
return true;
1139
1140
+ $remote = wp_remote_post( 'http://yarpp.org/optin/2/', array( 'body' => $this->optin_data() ) );
1141
if ( is_wp_error($remote) || !isset($remote['body']) || $remote['body'] != 'ok' ) {
1142
// try again later
1143
$this->set_transient( 'yarpp_optin', null, 60 * 60 );
readme.txt CHANGED
@@ -7,7 +7,7 @@ Donate link: http://tinyurl.com/donatetomitcho
7
Tags: related, posts, post, pages, page, RSS, feed, feeds
8
Requires at least: 3.3
9
Tested up to: 3.5
10
- Stable tag: 4.0
11
License: GPLv2 or later
12
13
Display a list of related entries on your site and feeds based on a unique algorithm. Now with thumbnail support built-in!
@@ -83,15 +83,31 @@ YARPP allows the advanced user with knowledge of PHP to customize the display of
83
84
If your question isn't here, ask your own question at [the WordPress.org forums](http://wordpress.org/support/plugin/yet-another-related-posts-plugin). *Please do not email with questions.*
85
86
- = How can I use the custom template feature? =
87
88
- YARPP's [custom templates feature](http://mitcho.com/blog/projects/yarpp-3-templates/) allows you to uber-customize the related posts display using the same coding conventions and [Template Tags](http://codex.wordpress.org/Template_Tags) as in WordPress themes. Custom templates must be in your *active theme's main directory* in order to be recognized by YARPP. If your theme did not ship with YARPP templates, move the files in the `yarpp-templates` directory which ships with YARPP into your active theme's main directory. Be sure to move the *files* (which must be named `yarpp-template-`...`.php`) to your theme, not the entire directory.
89
90
- = How can I move the related posts display? =
91
92
- If you do not want to show the Related Posts display in its default position (right below the post content), first go to YARPP options and turn off the "automatically display" option in the "website" section. If you would like to instead display it in your sidebar and you have a widget-aware theme, YARPP provides a Related Posts widget which you can add under "Appearance" > "Widgets".
93
94
- If you would like to add the Related Posts display elsewhere, edit your relevant theme file (most likely something like `single.php`) and add the PHP code `related_posts();` within [The Loop](http://codex.wordpress.org/The_Loop) where you want to display the related posts. This method can also be used to display YARPP on pages other than single-post displays, such as on archive pages.
95
96
= Does YARPP slow down my blog/server? =
97
@@ -243,10 +259,11 @@ If you are a bilingual speaker of English and another language and an avid user
243
244
= 4.0.1 =
245
* Improvements to thumbnail handling
246
- * Thumbnail size can be specified by adding `add_image_size( 'yarpp-thumbnail', $width, $height, true );` to your theme's `functions.php` file. In the future I may add some UI to the settings to also set this... feedback is requested on whether this is a good idea.
247
- * YARPP now registers its thumbnail size properly. To have WordPress build thumbnails of the right size, use the [Regenerate Thumbnails](http://wordpress.org/extend/plugins/regenerate-thumbnails/) plugin.
248
* Fixed a typo and simplified an item in the dynamic `styles-thumbnails.php` styles
249
- * Thumbnails of appropriate size can be generated on the fly, if they do not already exist, by calling `yarpp_set_option('generate_thumbnails', true);`. This is turned off by default and hidden for due to performance concerns.
250
* Bugfix: a class of `yarpp-related-` with a stray hyphen was sometimes being produced. Now fixed so it produces `yarpp-related`.
251
* [Bugfix](http://wordpress.org/support/topic/bug-in-sql-function-in-yarpp_cache): `term_relationships` table was being joined when unnecessary
252
* [Bugfix](http://wordpress.org/support/topic/no-option-to-add-widget-title-in-theme-using-hybrid-core-framework): widget options would not display if custom templates were not available
7
Tags: related, posts, post, pages, page, RSS, feed, feeds
8
Requires at least: 3.3
9
Tested up to: 3.5
10
+ Stable tag: 4.0.1
11
License: GPLv2 or later
12
13
Display a list of related entries on your site and feeds based on a unique algorithm. Now with thumbnail support built-in!
83
84
If your question isn't here, ask your own question at [the WordPress.org forums](http://wordpress.org/support/plugin/yet-another-related-posts-plugin). *Please do not email with questions.*
85
86
+ = How can I move the related posts display? =
87
88
+ If you do not want to show the Related Posts display in its default position (right below the post content), first go to YARPP options and turn off the "automatically display" options in the "website" section. If you would like to instead display it in your sidebar and you have a widget-aware theme, YARPP provides a Related Posts widget which you can add under "Appearance" > "Widgets".
89
90
+ If you would like to add the Related Posts display elsewhere, edit your relevant theme file (most likely something like `single.php`) and add the PHP code `related_posts();` within [The Loop](http://codex.wordpress.org/The_Loop) where you want to display the related posts.
91
+
92
+ = I'm using the Thumbnails display in YARPP 4. How can I change the thumbnail size? =
93
+
94
+ The thumbnail size can be specified programmatically by adding `add_image_size( 'yarpp-thumbnail', $width, $height, true );` to your theme's `functions.php` file with appropriate width and height variables. In the future I may add some UI to the settings to also set this... feedback is requested on whether this is a good idea.
95
+
96
+ Each time you change YARPP's thumbnail dimensions like this, you will probably want to have WordPress regenerate appropriate sized thumbnails for all of your images. I highly recommend the [Regenerate Thumbnails](http://wordpress.org/extend/plugins/regenerate-thumbnails/) plugin for this purpose. See also the next question.
97
98
+ = I'm using the Thumbnails display in YARPP 4. Why aren't the right size thumbnails being served? =
99
100
+ By default if an appropriately sized thumbnail is not available in WordPress, a larger image will be served and will be made to fit in the thumbnail space via CSS. Sometimes this means images will be scaled down in a weird way, so it is not ideal... what you really want is for YARPP to serve appropriately-sized thumbnails.
101
+
102
+ There are two options for doing so:
103
+
104
+ * First, you can use the [Regenerate Thumbnails](http://wordpress.org/extend/plugins/regenerate-thumbnails/) plugin to generate all these thumbnail-sized images in a batch process. This puts you in control of when this resizing process happens on your server (which is good because it can be processor-intensive). New images which are uploaded to WordPress should automatically get the appropriate thumbnail generated when the image is uploaded.
105
+
106
+ * Second, you can turn on a feature in YARPP to auto-generate appropriate size thumbnails on the fly, if they have not yet been created. Doing this type of processing on the fly does not scale well, so this feature is turned off by default. But if you run a smaller site with less traffic, it may work for you. Simply add `define('YARPP_GENERATE_THUMBNAILS', true);` to your theme's `functions.php` file.
107
+
108
+ = How can I use the custom template feature? =
109
+
110
+ YARPP's [custom templates feature](http://mitcho.com/blog/projects/yarpp-3-templates/) allows you to uber-customize the related posts display using the same coding conventions and [Template Tags](http://codex.wordpress.org/Template_Tags) as in WordPress themes. Custom templates must be in your *active theme's main directory* in order to be recognized by YARPP. If your theme did not ship with YARPP templates, move the files in the `yarpp-templates` directory which ships with YARPP into your active theme's main directory. Be sure to move the *files* (which must be named `yarpp-template-`...`.php`) to your theme, not the entire directory.
111
112
= Does YARPP slow down my blog/server? =
113
259
260
= 4.0.1 =
261
* Improvements to thumbnail handling
262
+ * See new FAQ entry for practical details
263
+ * Thumbnail size can be specified programmatically (see FAQ)
264
+ * YARPP now registers its thumbnail size properly as `yarpp-thumbnail`
265
* Fixed a typo and simplified an item in the dynamic `styles-thumbnails.php` styles
266
+ * Code to generate thumbnails of appropriate size on the fly has been added, but is turned off by default for performance reasons (see FAQ)
267
* Bugfix: a class of `yarpp-related-` with a stray hyphen was sometimes being produced. Now fixed so it produces `yarpp-related`.
268
* [Bugfix](http://wordpress.org/support/topic/bug-in-sql-function-in-yarpp_cache): `term_relationships` table was being joined when unnecessary
269
* [Bugfix](http://wordpress.org/support/topic/no-option-to-add-widget-title-in-theme-using-hybrid-core-framework): widget options would not display if custom templates were not available
template-thumbnails.php CHANGED
@@ -40,7 +40,7 @@ if (have_posts()) {
40
$output .= "<a class='yarpp-thumbnail' href='" . get_permalink() . "' title='" . the_title_attribute('echo=0') . "'>" . "\n";
41
42
if ( has_post_thumbnail() ) {
43
- if ( $this->get_option( 'generate_thumbnails' ) )
44
$this->ensure_resized_post_thumbnail( get_the_ID(), $size, $dimensions );
45
$output .= get_the_post_thumbnail( null, $size );
46
} else {
40
$output .= "<a class='yarpp-thumbnail' href='" . get_permalink() . "' title='" . the_title_attribute('echo=0') . "'>" . "\n";
41
42
if ( has_post_thumbnail() ) {
43
+ if ( $this->diagnostic_generate_thumbnails() )
44
$this->ensure_resized_post_thumbnail( get_the_ID(), $size, $dimensions );
45
$output .= get_the_post_thumbnail( null, $size );
46
} else {
yarpp.php CHANGED
@@ -3,13 +3,13 @@
3
Plugin Name: Yet Another Related Posts Plugin
4
Plugin URI: http://yarpp.org/
5
Description: Returns a list of related entries based on a unique algorithm for display on your blog and RSS feeds. Now with Now with thumbnail support built-in!
6
- Version: 4.0.1b3
7
Author: mitcho (Michael Yoshitaka Erlewine)
8
Author URI: http://mitcho.com/
9
Donate link: http://tinyurl.com/donatetomitcho
10
*/
11
12
- define('YARPP_VERSION', '4.0.1b3');
13
define('YARPP_DIR', dirname(__FILE__));
14
define('YARPP_NO_RELATED', ':(');
15
define('YARPP_RELATED', ':)');
3
Plugin Name: Yet Another Related Posts Plugin
4
Plugin URI: http://yarpp.org/
5
Description: Returns a list of related entries based on a unique algorithm for display on your blog and RSS feeds. Now with Now with thumbnail support built-in!
6
+ Version: 4.0.1
7
Author: mitcho (Michael Yoshitaka Erlewine)
8
Author URI: http://mitcho.com/
9
Donate link: http://tinyurl.com/donatetomitcho
10
*/
11
12
+ define('YARPP_VERSION', '4.0.1');
13
define('YARPP_DIR', dirname(__FILE__));
14
define('YARPP_NO_RELATED', ':(');
15
define('YARPP_RELATED', ':)');