Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/carawebs/wp-organise-posts/archive/refs/heads/master.zipOn Packagist as carawebs/wp-organise-posts:
composer require carawebs/wp-organise-postsNo built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.
Organise Posts by Drag and Drop
Set the display order of Custom Post Types by drag and drop on the posts edit screen. Ordering is achieved by an index that is set when you drag and drop them in place.
Build Notes
A post meta value is used to order projects on project-category taxonomy archive pages.
It was tricky to create a modified loop that displayed:
FIRST: projects with the relevant post meta key set, in the correct order as determined by the value
SECOND: projects without the key
The key value pairing will be added after sorting, so it is important that all projects are shown, even if they don't have the key.
~~~
query['project-category'];
// Standardised key for post meta
$key = "project-category-$thisterm";
$query-set( 'metaquery', [
'relation' = 'OR',
[ 'key' = $key, 'compare' = 'EXISTS' ],
[ 'key' = $key, 'compare' = 'NOT EXISTS' ]
]);
$query-set( 'orderby', [ $key = 'ASC', 'date' = 'DESC' ] );
}
~~~
This simple query returns all posts with the key, by value order:
~~~
query['project-category'];
// Standardised key for post meta
$key = "project-category-$thisterm";
// Set the metakey and orderby it's