Skip to content

Commit

Permalink
rewrite for v2
Browse files Browse the repository at this point in the history
  • Loading branch information
aurovrata committed Sep 16, 2019
1 parent 04acc6b commit 6eb9269
Show file tree
Hide file tree
Showing 86 changed files with 25,355 additions and 1,006 deletions.
11 changes: 5 additions & 6 deletions LICENSE → LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991

Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Expand Down Expand Up @@ -290,8 +290,8 @@ to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

{description}
Copyright (C) {year} {fullname}
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -329,12 +329,11 @@ necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.

{signature of Ty Coon}, 1 April 1989
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice

This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

Public License instead of this License.
5 changes: 0 additions & 5 deletions README.md

This file was deleted.

31 changes: 26 additions & 5 deletions readme.txt → README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Contributors: aurelien, aurovrata
Tags: order, reorder, re order, order by category,order custom post type, order by categories, order category, order categories, order by taxonomy, order by taxonomies
Requires at least: 3.4
Tested up to: 5.0.3
Tested up to: 5.2.0
Requires PHP: 5.6
Stable tag: trunk
License: GPLv2
Expand Down Expand Up @@ -33,7 +33,7 @@ It works with a selected category, each category can have different order of sam
2. Re-order your post through a drag & drop interface

== FAQ ==
= Modify the reorder category query =
= 1.Modify the reorder category query =

A filter allows you to hook into the query of the posts before your reorder them in the dashboard. This is useful is you want to order parent terms posts and not children. WP post category query by default include post from children terms, which will show up in the order list. So by excluding them you are able to order only the posts of parent terms,
`
Expand All @@ -43,14 +43,14 @@ function exclude_children($args) {
return $args;
}`

= I want to order posts in non-hierarchical taxonomies (tags) =
= 2.I want to order posts in non-hierarchical taxonomies (tags) =
By default the plugin allows you to order posts only within hierarchical taxonomies (categories). This is done as a means to ensure one doesn't have spurious orders as allowing both tags and category ordering could lead to users trying to order a post in both and this would create issues which have not been tested by this author. Hence tread with caution if you enable this in your functions.php file,

`add_filter('reorder_post_within_categories_and_tags', '__return__true');`

Keep in mind that you will now see `Pages` as a post type to re-order, selecting such post types which do not have any categories associated with it.

= I want limit/enable roles that can re-order posts =
= 3.I want limit/enable roles that can re-order posts =

Since v1.3.0 a new filter has been added that allows you to do that. Make sure you return a [valid capability](https://codex.wordpress.org/Roles_and_Capabilities#Capabilities),

Expand All @@ -64,12 +64,33 @@ function enable_editors($capability, $post_type){
}`
if an unknown capability is returned, the plugin will default back to 'manage_categories' which is an administrator's capability.

= I am uninstalling this plugin, how do I removed the custom table data ? =
= 4.I am uninstalling this plugin, how do I removed the custom table data ? =
You can now flag the custom sql table to be deleted when you disable the plugin from your dashboard with the following filter,
` add_filter('reorder_post_within_categories_delete_custom_table', '__return__true')`
note that this filter is fired when you disable the plugin in the dashboard. So make sure it is activated when you set this filter.

= 5.Can newly published posts be ranked first rather than last? =
Yes, as of v2.0 newly published posts can be ranked first instead of last by default using the follwoing filter,

`add-filter('reorder_post_within_categories_new_post_first', 'rank_new_posts', 10, 3);
function rank_new_posts($is_first, $post, $term){
$is_first = true;
//you can filter by taxonomy term, or other post parameters.
//WP_Post $post;
//WP_Term $term.
return $is_first;
}
`
NOTE: the post-type must already have a manual ranking for that category term for this hook to fire. TO ensure this, go to the post ReOrder admin page, select the category term and manually order a couple of post, this is enough to ensure this hook fires. Even if you have the manual ranking radio-toggle to 'No', this hook will still fire.

== Changelog ==
= 2.0.0 =
* complete re-write of the plugin file structure.
* removal of custom DB table, post rank is now saved as a postmeta key.
* addition of a new filter 'reorder_post_within_categories_new_post_first' to allow new posts to be ranked first instead of last by default.
* proper handling of post_type for order ranking.


= 1.8.1 =
* english corrections.
= 1.8.0 =
Expand Down
Loading

0 comments on commit 6eb9269

Please sign in to comment.