Version Description
- Support for category names in related posts
Download this release
Release Info
Developer | ddksr |
Plugin | WordPress Related Posts |
Version | 3.6 |
Comparing to | |
See all releases |
Code changes from version 3.5.4 to 3.6
- config.php +12 -0
- init.php +23 -3
- readme.txt +5 -2
- recommendations.php +21 -0
- settings.php +1 -0
- static/img/arrow_down.png +0 -0
- static/img/arrow_right.png +0 -0
- static/img/check.png +0 -0
- static/img/close.png +0 -0
- static/img/cross.png +0 -0
- static/img/cross_2x.png +0 -0
- static/img/down.png +0 -0
- static/img/icon_support.png +0 -0
- static/img/measure_icon.png +0 -0
- static/img/measure_icon_2x.png +0 -0
- static/img/menu_icon.png +0 -0
- static/img/menu_icon_2x.png +0 -0
- static/img/network_icon.png +0 -0
- static/img/outlink.png +0 -0
- static/img/up.png +0 -0
- static/themes/m-modern.css +5 -0
- static/themes/m-stream.css +5 -0
- static/themes/modern.css +5 -0
- static/themes/momma.css +4 -0
- static/themes/pinterest.css +4 -0
- static/themes/twocolumns.css +4 -0
- static/themes/vertical-m.css +4 -0
- static/themes/vertical-s.css +4 -0
- static/themes/vertical.css +4 -0
- uploader.php +1 -0
- views/settings.php +4 -0
- wp_related_posts.php +1 -1
- zemanta/img/logo.png +0 -0
config.php
CHANGED
@@ -234,6 +234,7 @@ function wp_rp_install() {
|
|
234 |
'display_publish_date' => false,
|
235 |
'display_thumbnail' => true,
|
236 |
'display_excerpt' => false,
|
|
|
237 |
'excerpt_max_length' => 200,
|
238 |
'theme_name' => 'vertical-m.css',
|
239 |
'theme_custom_css' => WP_RP_DEFAULT_CUSTOM_CSS,
|
@@ -255,6 +256,17 @@ function wp_rp_is_classic() {
|
|
255 |
return false;
|
256 |
}
|
257 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
258 |
function wp_rp_migrate_3_5_3() {
|
259 |
$meta = get_option('wp_rp_meta');
|
260 |
$meta['version'] = '3.5.4';
|
234 |
'display_publish_date' => false,
|
235 |
'display_thumbnail' => true,
|
236 |
'display_excerpt' => false,
|
237 |
+
'display_category' => false,
|
238 |
'excerpt_max_length' => 200,
|
239 |
'theme_name' => 'vertical-m.css',
|
240 |
'theme_custom_css' => WP_RP_DEFAULT_CUSTOM_CSS,
|
256 |
return false;
|
257 |
}
|
258 |
|
259 |
+
function wp_rp_migrate_3_5_4() {
|
260 |
+
$meta = get_option('wp_rp_meta');
|
261 |
+
$meta['version'] = '3.6';
|
262 |
+
$meta['new_user'] = false;
|
263 |
+
update_option('wp_rp_meta', $meta);
|
264 |
+
|
265 |
+
$options = get_option('wp_rp_options');
|
266 |
+
$options['desktop']['display_category'] = false;
|
267 |
+
update_option('wp_rp_options', $options);
|
268 |
+
}
|
269 |
+
|
270 |
function wp_rp_migrate_3_5_3() {
|
271 |
$meta = get_option('wp_rp_meta');
|
272 |
$meta['version'] = '3.5.4';
|
init.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
define('WP_RP_VERSION', '3.
|
3 |
|
4 |
define('WP_RP_PLUGIN_FILE', plugin_basename(__FILE__));
|
5 |
|
@@ -282,7 +282,7 @@ function wp_rp_text_shorten($text, $max_chars) {
|
|
282 |
return $shortened_text . WP_RP_EXCERPT_SHORTENED_SYMBOL; //'...';
|
283 |
}
|
284 |
|
285 |
-
function wp_rp_generate_related_posts_list_items($related_posts, $selected_related_posts) {
|
286 |
$options = wp_rp_get_options();
|
287 |
$platform_options = wp_rp_get_platform_options();
|
288 |
$output = "";
|
@@ -362,6 +362,21 @@ function wp_rp_generate_related_posts_list_items($related_posts, $selected_relat
|
|
362 |
$output .= ' <small class="wp_rp_excerpt">' . $excerpt . '</small>';
|
363 |
}
|
364 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
365 |
$output .= '</li>';
|
366 |
}
|
367 |
|
@@ -506,6 +521,11 @@ function wp_rp_get_related_posts($before_title = '', $after_title = '') {
|
|
506 |
return;
|
507 |
}
|
508 |
|
|
|
|
|
|
|
|
|
|
|
509 |
$posts_footer = '';
|
510 |
if (current_user_can($options['only_admins_can_edit_related_posts'] ? 'manage_options' : 'edit_posts')) {
|
511 |
$posts_footer .= '<div class="wp_rp_footer"><a class="wp_rp_edit" href="#" id="wp_rp_edit_related_posts">Edit Related Posts</a></div>';
|
@@ -517,7 +537,7 @@ function wp_rp_get_related_posts($before_title = '', $after_title = '') {
|
|
517 |
$css_classes = 'related_post wp_rp';
|
518 |
$css_classes_wrap = ' ' . str_replace(array('.css', '-'), array('', '_'), esc_attr('wp_rp_' . $platform_options['theme_name']));
|
519 |
|
520 |
-
$related_posts_lis = wp_rp_generate_related_posts_list_items($related_posts, $selected_related_posts);
|
521 |
$related_posts_ul = '<ul class="' . $css_classes . '">' . $related_posts_lis . '</ul>';
|
522 |
|
523 |
$related_posts_title = $title ? ($before_title ? $before_title . $title . $after_title : '<h3 class="related_post_title">' . $title . '</h3>') : '';
|
1 |
<?php
|
2 |
+
define('WP_RP_VERSION', '3.6');
|
3 |
|
4 |
define('WP_RP_PLUGIN_FILE', plugin_basename(__FILE__));
|
5 |
|
282 |
return $shortened_text . WP_RP_EXCERPT_SHORTENED_SYMBOL; //'...';
|
283 |
}
|
284 |
|
285 |
+
function wp_rp_generate_related_posts_list_items($related_posts, $selected_related_posts, $post_categories) {
|
286 |
$options = wp_rp_get_options();
|
287 |
$platform_options = wp_rp_get_platform_options();
|
288 |
$output = "";
|
362 |
$output .= ' <small class="wp_rp_excerpt">' . $excerpt . '</small>';
|
363 |
}
|
364 |
}
|
365 |
+
if ($platform_options["display_category"] && !empty($post_categories)){
|
366 |
+
$output .= ' <small class="wp_rp_category">Posted in ';
|
367 |
+
$num_categories = 0;
|
368 |
+
$id = $related_post->ID;
|
369 |
+
if (strpos($id, "in_") !== false) { $id = substr($id, 3); }
|
370 |
+
foreach($post_categories[$id] as $cat_id => $cat_name) {
|
371 |
+
$cat_url = esc_url(get_category_link($cat_id));
|
372 |
+
if ($num_categories > 0) {
|
373 |
+
$output .= ', ';
|
374 |
+
}
|
375 |
+
$output .= '<a href="' . $cat_url . '" target="_parent">' . $cat_name . '</a>';
|
376 |
+
$num_categories++;
|
377 |
+
}
|
378 |
+
$output .= '</small>';
|
379 |
+
}
|
380 |
$output .= '</li>';
|
381 |
}
|
382 |
|
521 |
return;
|
522 |
}
|
523 |
|
524 |
+
$post_categories = array();
|
525 |
+
if ($platform_options["display_category"]){
|
526 |
+
$post_categories = wp_rp_get_post_categories();
|
527 |
+
}
|
528 |
+
|
529 |
$posts_footer = '';
|
530 |
if (current_user_can($options['only_admins_can_edit_related_posts'] ? 'manage_options' : 'edit_posts')) {
|
531 |
$posts_footer .= '<div class="wp_rp_footer"><a class="wp_rp_edit" href="#" id="wp_rp_edit_related_posts">Edit Related Posts</a></div>';
|
537 |
$css_classes = 'related_post wp_rp';
|
538 |
$css_classes_wrap = ' ' . str_replace(array('.css', '-'), array('', '_'), esc_attr('wp_rp_' . $platform_options['theme_name']));
|
539 |
|
540 |
+
$related_posts_lis = wp_rp_generate_related_posts_list_items($related_posts, $selected_related_posts, $post_categories);
|
541 |
$related_posts_ul = '<ul class="' . $css_classes . '">' . $related_posts_lis . '</ul>';
|
542 |
|
543 |
$related_posts_title = $title ? ($before_title ? $before_title . $title . $after_title : '<h3 class="related_post_title">' . $title . '</h3>') : '';
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: zemanta
|
|
3 |
Tags: related,posts,post,related posts,plugin,seo
|
4 |
License: GPLv2
|
5 |
Requires at least: 3.6
|
6 |
-
Tested up to: 4.
|
7 |
-
Stable tag: 3.
|
8 |
|
9 |
WordPress Related Posts - the plugin for related posts with thumbnails. Caching included.
|
10 |
|
@@ -93,6 +93,9 @@ Fix for security vulnerability. Upgrade immediately.
|
|
93 |
|
94 |
== Changelog ==
|
95 |
|
|
|
|
|
|
|
96 |
= 3.5.4 =
|
97 |
* Fixed bug that prevented image download from posts
|
98 |
* Pinterest theme fixes
|
3 |
Tags: related,posts,post,related posts,plugin,seo
|
4 |
License: GPLv2
|
5 |
Requires at least: 3.6
|
6 |
+
Tested up to: 4.6
|
7 |
+
Stable tag: 3.6
|
8 |
|
9 |
WordPress Related Posts - the plugin for related posts with thumbnails. Caching included.
|
10 |
|
93 |
|
94 |
== Changelog ==
|
95 |
|
96 |
+
= 3.6 =
|
97 |
+
* Support for category names in related posts
|
98 |
+
|
99 |
= 3.5.4 =
|
100 |
* Fixed bug that prevented image download from posts
|
101 |
* Pinterest theme fixes
|
recommendations.php
CHANGED
@@ -356,3 +356,24 @@ function wp_rp_fetch_random_posts($limit = 10, $exclude_ids = array()) {
|
|
356 |
array_multisort($ids_keys, $results);
|
357 |
return $results;
|
358 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
356 |
array_multisort($ids_keys, $results);
|
357 |
return $results;
|
358 |
}
|
359 |
+
|
360 |
+
function wp_rp_get_post_categories() {
|
361 |
+
global $wpdb;
|
362 |
+
|
363 |
+
$post_query = "SELECT p.ID as pid, te.name as cat_name, te.term_id as cat_id
|
364 |
+
FROM $wpdb->posts p, $wpdb->terms te, $wpdb->term_taxonomy tt, $wpdb->term_relationships tr
|
365 |
+
WHERE p.post_status = 'publish' AND p.post_type = 'post'
|
366 |
+
AND tt.taxonomy='category' AND tt.term_id = te.term_id
|
367 |
+
AND tr.object_id = p.ID AND tt.term_taxonomy_id = tr.term_taxonomy_id";
|
368 |
+
$posts = $wpdb->get_results($post_query);
|
369 |
+
|
370 |
+
$result = array();
|
371 |
+
foreach($posts as $row) {
|
372 |
+
if (!isset($result[$row->pid])) {
|
373 |
+
$result[$row->pid] = array();
|
374 |
+
}
|
375 |
+
$result[$row->pid][$row->cat_id] = $row->cat_name;
|
376 |
+
}
|
377 |
+
return $result;
|
378 |
+
}
|
379 |
+
|
settings.php
CHANGED
@@ -265,6 +265,7 @@ function wp_rp_settings_page() {
|
|
265 |
'display_comment_count' => isset($postdata['wp_rp_desktop_display_comment_count']),
|
266 |
'display_publish_date' => isset($postdata['wp_rp_desktop_display_publish_date']),
|
267 |
'display_excerpt' => isset($postdata['wp_rp_desktop_display_excerpt']),
|
|
|
268 |
'display_thumbnail' => isset($postdata['wp_rp_desktop_display_thumbnail']),
|
269 |
'excerpt_max_length' => (isset($postdata['wp_rp_desktop_excerpt_max_length']) && is_numeric(trim($postdata['wp_rp_desktop_excerpt_max_length']))) ? intval(trim($postdata['wp_rp_desktop_excerpt_max_length'])) : 200,
|
270 |
'custom_theme_enabled' => isset($postdata['wp_rp_desktop_custom_theme_enabled']),
|
265 |
'display_comment_count' => isset($postdata['wp_rp_desktop_display_comment_count']),
|
266 |
'display_publish_date' => isset($postdata['wp_rp_desktop_display_publish_date']),
|
267 |
'display_excerpt' => isset($postdata['wp_rp_desktop_display_excerpt']),
|
268 |
+
'display_category' => isset($postdata['wp_rp_desktop_display_category']),
|
269 |
'display_thumbnail' => isset($postdata['wp_rp_desktop_display_thumbnail']),
|
270 |
'excerpt_max_length' => (isset($postdata['wp_rp_desktop_excerpt_max_length']) && is_numeric(trim($postdata['wp_rp_desktop_excerpt_max_length']))) ? intval(trim($postdata['wp_rp_desktop_excerpt_max_length'])) : 200,
|
271 |
'custom_theme_enabled' => isset($postdata['wp_rp_desktop_custom_theme_enabled']),
|
static/img/arrow_down.png
CHANGED
Binary file
|
static/img/arrow_right.png
CHANGED
Binary file
|
static/img/check.png
CHANGED
Binary file
|
static/img/close.png
CHANGED
Binary file
|
static/img/cross.png
CHANGED
Binary file
|
static/img/cross_2x.png
CHANGED
Binary file
|
static/img/down.png
CHANGED
Binary file
|
static/img/icon_support.png
CHANGED
Binary file
|
static/img/measure_icon.png
CHANGED
Binary file
|
static/img/measure_icon_2x.png
CHANGED
Binary file
|
static/img/menu_icon.png
CHANGED
Binary file
|
static/img/menu_icon_2x.png
CHANGED
Binary file
|
static/img/network_icon.png
CHANGED
Binary file
|
static/img/outlink.png
CHANGED
Binary file
|
static/img/up.png
CHANGED
Binary file
|
static/themes/m-modern.css
CHANGED
@@ -69,6 +69,10 @@ ul.related_post li img {
|
|
69 |
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2) !important;
|
70 |
}
|
71 |
|
|
|
|
|
|
|
|
|
72 |
ul.related_post li a img.wp_rp_santa_hat {
|
73 |
display: none !important;
|
74 |
}
|
@@ -97,3 +101,4 @@ ul.related_post li small {
|
|
97 |
height: 100px !important;
|
98 |
}
|
99 |
}
|
|
69 |
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2) !important;
|
70 |
}
|
71 |
|
72 |
+
ul.related_post li .wp_rp_category a {
|
73 |
+
display: inline !important;
|
74 |
+
}
|
75 |
+
|
76 |
ul.related_post li a img.wp_rp_santa_hat {
|
77 |
display: none !important;
|
78 |
}
|
101 |
height: 100px !important;
|
102 |
}
|
103 |
}
|
104 |
+
|
static/themes/m-stream.css
CHANGED
@@ -97,3 +97,8 @@ ul.related_post li small {
|
|
97 |
height: 100px !important;
|
98 |
}
|
99 |
}
|
|
|
|
|
|
|
|
|
|
97 |
height: 100px !important;
|
98 |
}
|
99 |
}
|
100 |
+
|
101 |
+
ul.related_post li .wp_rp_category a {
|
102 |
+
display: inline !important;
|
103 |
+
}
|
104 |
+
|
static/themes/modern.css
CHANGED
@@ -83,3 +83,8 @@ ul.related_post li a.wp_rp_thumbnail img {
|
|
83 |
margin-right: 0 !important;
|
84 |
display: block !important;
|
85 |
}
|
|
|
|
|
|
|
|
|
|
83 |
margin-right: 0 !important;
|
84 |
display: block !important;
|
85 |
}
|
86 |
+
|
87 |
+
ul.related_post li .wp_rp_category a {
|
88 |
+
display: inline !important;
|
89 |
+
}
|
90 |
+
|
static/themes/momma.css
CHANGED
@@ -130,3 +130,7 @@ ul.related_post li small {
|
|
130 |
font-size: 14px !important;
|
131 |
}
|
132 |
}
|
|
|
|
|
|
|
|
130 |
font-size: 14px !important;
|
131 |
}
|
132 |
}
|
133 |
+
|
134 |
+
ul.related_post li .wp_rp_category a {
|
135 |
+
display: inline !important;
|
136 |
+
}
|
static/themes/pinterest.css
CHANGED
@@ -178,3 +178,7 @@ div.wp_rp_footer a.wp_rp_edit {
|
|
178 |
border-radius: 2px !important;
|
179 |
padding: 3px 6px;
|
180 |
}
|
|
|
|
|
|
|
|
178 |
border-radius: 2px !important;
|
179 |
padding: 3px 6px;
|
180 |
}
|
181 |
+
|
182 |
+
ul.related_post li .wp_rp_category a {
|
183 |
+
display: inline !important;
|
184 |
+
}
|
static/themes/twocolumns.css
CHANGED
@@ -77,3 +77,7 @@ div.wp_rp_footer a.wp_rp_edit {
|
|
77 |
column-rule: none !important;
|
78 |
}
|
79 |
}
|
|
|
|
|
|
|
|
77 |
column-rule: none !important;
|
78 |
}
|
79 |
}
|
80 |
+
|
81 |
+
ul.related_post li .wp_rp_category a {
|
82 |
+
display: inline !important;
|
83 |
+
}
|
static/themes/vertical-m.css
CHANGED
@@ -91,3 +91,7 @@ ul.related_post li small {
|
|
91 |
height: 100px !important;
|
92 |
}
|
93 |
}
|
|
|
|
|
|
|
|
91 |
height: 100px !important;
|
92 |
}
|
93 |
}
|
94 |
+
|
95 |
+
ul.related_post li .wp_rp_category a {
|
96 |
+
display: inline !important;
|
97 |
+
}
|
static/themes/vertical-s.css
CHANGED
@@ -87,3 +87,7 @@ ul.related_post li small {
|
|
87 |
font-size: 14px !important;
|
88 |
}
|
89 |
}
|
|
|
|
|
|
|
|
87 |
font-size: 14px !important;
|
88 |
}
|
89 |
}
|
90 |
+
|
91 |
+
ul.related_post li .wp_rp_category a {
|
92 |
+
display: inline !important;
|
93 |
+
}
|
static/themes/vertical.css
CHANGED
@@ -87,3 +87,7 @@ ul.related_post li small {
|
|
87 |
font-size: 14px !important;
|
88 |
}
|
89 |
}
|
|
|
|
|
|
|
|
87 |
font-size: 14px !important;
|
88 |
}
|
89 |
}
|
90 |
+
|
91 |
+
ul.related_post li .wp_rp_category a {
|
92 |
+
display: inline !important;
|
93 |
+
}
|
uploader.php
CHANGED
@@ -44,6 +44,7 @@ function wp_rp_upload_articles($api_key) {
|
|
44 |
"posts" => array(),
|
45 |
);
|
46 |
foreach(get_posts() as $post) {
|
|
|
47 |
$obj = array(
|
48 |
"ID" => $post->ID,
|
49 |
"URL" => get_permalink($post->ID),
|
44 |
"posts" => array(),
|
45 |
);
|
46 |
foreach(get_posts() as $post) {
|
47 |
+
if ($post->post_status !== "publish" || $post->post_type !== "post") { continue; }
|
48 |
$obj = array(
|
49 |
"ID" => $post->ID,
|
50 |
"URL" => get_permalink($post->ID),
|
views/settings.php
CHANGED
@@ -130,6 +130,10 @@
|
|
130 |
<label id="wp_rp_desktop_excerpt_max_length_label">
|
131 |
<input name="wp_rp_desktop_excerpt_max_length" type="text" id="wp_rp_desktop_excerpt_max_length" class="small-text" value="<?php esc_attr_e($options['desktop']["excerpt_max_length"]); ?>" /> <span class="description"><?php _e('Maximum Number of Characters.', 'wp_related_posts'); ?></span>
|
132 |
</label><br />
|
|
|
|
|
|
|
|
|
133 |
<label>
|
134 |
<input type="checkbox" id="wp_rp_desktop_custom_theme_enabled" name="wp_rp_desktop_custom_theme_enabled" value="yes" <?php checked($options['desktop']['custom_theme_enabled']); ?> />
|
135 |
<?php _e("Enable custom CSS",'wp_related_posts'); ?>
|
130 |
<label id="wp_rp_desktop_excerpt_max_length_label">
|
131 |
<input name="wp_rp_desktop_excerpt_max_length" type="text" id="wp_rp_desktop_excerpt_max_length" class="small-text" value="<?php esc_attr_e($options['desktop']["excerpt_max_length"]); ?>" /> <span class="description"><?php _e('Maximum Number of Characters.', 'wp_related_posts'); ?></span>
|
132 |
</label><br />
|
133 |
+
<label>
|
134 |
+
<input name="wp_rp_desktop_display_category" type="checkbox" id="wp_rp_desktop_display_category" value="yes" <?php checked($options['desktop']["display_category"]); ?>>
|
135 |
+
<?php _e("Display Post Categories",'wp_related_posts');?>
|
136 |
+
</label><br />
|
137 |
<label>
|
138 |
<input type="checkbox" id="wp_rp_desktop_custom_theme_enabled" name="wp_rp_desktop_custom_theme_enabled" value="yes" <?php checked($options['desktop']['custom_theme_enabled']); ?> />
|
139 |
<?php _e("Enable custom CSS",'wp_related_posts'); ?>
|
wp_related_posts.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: WordPress Related Posts
|
4 |
-
Version: 3.
|
5 |
Plugin URI: http://wordpress.org/extend/plugins/wordpress-23-related-posts-plugin/
|
6 |
Description: Quickly increase your readers' engagement with your posts by adding Related Posts in the footer of your content. Click on <a href="admin.php?page=wordpress-related-posts">Related Posts tab</a> to configure your settings.
|
7 |
Author: Zemanta Ltd.
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: WordPress Related Posts
|
4 |
+
Version: 3.6
|
5 |
Plugin URI: http://wordpress.org/extend/plugins/wordpress-23-related-posts-plugin/
|
6 |
Description: Quickly increase your readers' engagement with your posts by adding Related Posts in the footer of your content. Click on <a href="admin.php?page=wordpress-related-posts">Related Posts tab</a> to configure your settings.
|
7 |
Author: Zemanta Ltd.
|
zemanta/img/logo.png
CHANGED
Binary file
|