Skip to content

Commit

Permalink
v2.5.5
Browse files Browse the repository at this point in the history
  • Loading branch information
aurovrata committed May 10, 2020
1 parent 3479f50 commit 15d18b9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
6 changes: 6 additions & 0 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,13 @@ NOTE: note that this will effect front-end mixed-queries trying to display both

**NOTE**: in all 3 cases, you may use the reset button (see screenshot #3) on the reorder admin page to get the filters to change the order.

= Thanks to =
@maddogprod for helping resolve custom taxonomy front-end ordering.
@menard1965 for helping resolve `get_adjacent_post` prev/next ranked posts.

== Changelog ==
= 2.5.5 =
* fix get_adjacent_post_where SQL query.
= 2.5.4 =
* change get_adjacent_post_where SQL for older DB.
* fix admin reverse order saving.
Expand Down
11 changes: 7 additions & 4 deletions public/class-reorder-post-within-categories-public.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ private function is_ranked($taxonomy, $term_id, &$type, $wp_query=null){
* @param String $taxonomy being queried.
* @param WP_Query $wp_query query object.
*/
$type = apply_filters('reorderpwc_filter_multiple_post_type',$type, $post_types, $taxonomy, $wp_query);
$type = apply_filters('reorderpwc_filter_multiple_post_type',$type, $post_type, $taxonomy, $wp_query);
if(empty($type) || !is_string($type)){
return false;
}
Expand Down Expand Up @@ -291,13 +291,16 @@ protected function get_adjacent_post_where($where, $in_same_term, $excluded_term
// debug_msg($where, 'where ');
if(!empty($term)){
$compare = '>';
if('prev'==$pos) $compare='<';

$order = "ASC";
if('prev'==$pos){
$compare='<';
$order = "DESC";
}
global $wpdb;
// debug_msg($wpdb->db_version(), 'version ');
$adj_id = $wpdb->get_var("SELECT (
SELECT rankpm.post_id FROM {$wpdb->postmeta} as rankpm LEFT JOIN {$wpdb->posts} AS rankp ON rankp.ID=rankpm.post_id
WHERE rankpm.meta_key like '_rpwc2' AND rankpm.meta_value={$term} AND rankp.post_type LIKE '{$post->post_type}' AND rankpm.meta_id{$compare}selectp.meta_id ORDER BY rankpm.meta_id ASC LIMIT 1 OFFSET 0
WHERE rankpm.meta_key like '_rpwc2' AND rankpm.meta_value={$term} AND rankp.post_type LIKE '{$post->post_type}' AND rankpm.meta_id{$compare}selectp.meta_id ORDER BY rankpm.meta_id {$order} LIMIT 1 OFFSET 0
) AS next_post FROM {$wpdb->postmeta} AS selectp
WHERE selectp.meta_id = (SELECT meta_id FROM {$wpdb->postmeta} WHERE post_id={$post->ID} AND meta_key LIKE '_rpwc2' AND meta_value={$term})");

Expand Down
4 changes: 2 additions & 2 deletions reorder-post-within-categories.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* Plugin Name: ReOrder Posts within Categories
* Plugin URI: https://github.com/aurovrata/ReOrder-posts-within-categories
* Description: This is a short description of what the plugin does. It's displayed in the WordPress admin area.
* Version: 2.5.4
* Version: 2.5.5
* Author: Aurorata V.
* Author URI: https://profiles.wordpress.org/aurovrata/
* License: GPL-2.0+
Expand All @@ -33,7 +33,7 @@
/**
* Current plugin version.
*/
define( 'REORDER_POST_WITHIN_CATEGORIES_VERSION', '2.5.4' );
define( 'REORDER_POST_WITHIN_CATEGORIES_VERSION', '2.5.5' );
//options for plugin used in both public and admin classes.
define('RPWC_OPTIONS', 'deefuse_ReOrderOrderedCategoriesOptions');

Expand Down

0 comments on commit 15d18b9

Please sign in to comment.