11 Commits

Author SHA1 Message Date
735a4c3038 Merge pull request 'Improve query args modification with term relationship' (#4) from query-block into main
Reviewed-on: #4
2026-03-03 23:17:26 +00:00
Cooper Dalrymple
37572b5a8a Improve identification of tax query term 2026-03-03 17:16:00 -06:00
Cooper Dalrymple
681e2ed152 Prevent modifying query if term not found 2026-03-03 17:11:33 -06:00
Cooper Dalrymple
79fff56a25 Remove SFTP 2026-03-03 17:00:58 -06:00
Cooper Dalrymple
06485c47b2 Fix package root 2026-03-03 14:28:34 -06:00
Cooper Dalrymple
063c4a6ed6 Push to version 1.1.1 2026-03-03 14:11:11 -06:00
b3233a13b9 Merge pull request 'Add Slugs to Admin UI' (#3) from admin-taxonomy-name into main
Reviewed-on: #3
2026-03-03 20:04:56 +00:00
Cooper Dalrymple
fe1ff96dbc Add name slugs to admin ui 2026-03-03 14:02:49 -06:00
Cooper Dalrymple
d1ae5f021a Fix undefined array key notice 2026-01-23 09:34:32 -06:00
Cooper Dalrymple
7b4aa346c6 Update packages 2026-01-21 20:21:39 -06:00
Cooper Dalrymple
a9333e38f1 Update to version 1.1.0 2026-01-21 20:19:09 -06:00
12 changed files with 73 additions and 34 deletions

View File

@@ -26,4 +26,4 @@ jobs:
uses: akkuman/gitea-release-action@v1 uses: akkuman/gitea-release-action@v1
with: with:
files: |- files: |-
*.zip dist/*.zip

1
.gitignore vendored
View File

@@ -2,3 +2,4 @@ vendor
lib lib
node_modules node_modules
*.zip *.zip
dist

View File

@@ -1,7 +1,7 @@
{ {
"$schema": "https://getcomposer.org/schema.json", "$schema": "https://getcomposer.org/schema.json",
"name": "cleverogre/ogre-sort", "name": "cleverogre/ogre-sort",
"version": "1.0.0", "version": "1.1.1",
"title": "Ogre Sort", "title": "Ogre Sort",
"description": "WordPress plugin which enables drag-and-drop sorting within the admin area for posts, terms, and posts within terms.", "description": "WordPress plugin which enables drag-and-drop sorting within the admin area for posts, terms, and posts within terms.",
"author": "CleverOgre", "author": "CleverOgre",

2
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "fe877c0f300b012a3667fb458d1768b3", "content-hash": "0e7b2523bace7acb04e7c97d1e711d62",
"packages": [ "packages": [
{ {
"name": "cleverogre/plugin-framework", "name": "cleverogre/plugin-framework",

View File

@@ -1,19 +1,37 @@
const gulp = require('gulp'), const fs = require('fs'),
gulp = require('gulp'),
clean = require('gulp-clean'), clean = require('gulp-clean'),
path = require('path'),
zip = require('gulp-zip').default; zip = require('gulp-zip').default;
const NAME = path.basename(__dirname); const PACKAGE = require('./package.json');
const NAME = PACKAGE.name.split('/').pop();
// Clean Tasks // Clean Tasks
gulp.task('clean-package', () => { gulp.task('clean-package-files', (done) => {
return gulp.src(`${NAME}.zip`, { if (!fs.existsSync('./dist')) return done();
return gulp.src(`./dist/${NAME}`, {
read: false, read: false,
allowEmpty: true, allowEmpty: true,
}).pipe(clean()); }).pipe(clean());
}); });
gulp.task('clean-package-zip', (done) => {
if (!fs.existsSync('./dist')) return done();
return gulp.src('./dist/*.zip', {
read: false,
allowEmpty: true,
}).pipe(clean());
});
gulp.task(
'clean-package',
gulp.series(
'clean-package-files',
'clean-package-zip'
)
);
gulp.task( gulp.task(
'clean', 'clean',
gulp.series( gulp.series(
@@ -23,7 +41,7 @@ gulp.task(
// Package Tasks // Package Tasks
gulp.task('package-compress', () => { gulp.task('package-copy', () => {
return gulp.src([ return gulp.src([
'assets/**/*', 'assets/**/*',
'inc/**/*', 'inc/**/*',
@@ -35,16 +53,26 @@ gulp.task('package-compress', () => {
], { ], {
base: './', base: './',
encoding: false, encoding: false,
})
.pipe(gulp.dest(`./dist/${NAME}`));
});
gulp.task('package-compress', () => {
return gulp.src(`./dist/${NAME}/**/*`, {
base: './dist',
encoding: false,
}) })
.pipe(zip(`${NAME}.zip`)) .pipe(zip(`${NAME}.zip`))
.pipe(gulp.dest('./')); .pipe(gulp.dest('./dist'));
}); });
gulp.task( gulp.task(
'package', 'package',
gulp.series( gulp.series(
'clean', 'clean',
'package-compress' 'package-copy',
'package-compress',
'clean-package-files'
) )
); );

View File

@@ -2,7 +2,7 @@
/** /**
* @package ogre-sort * @package ogre-sort
* @author cleverogre * @author cleverogre
* @copyright 2025 CleverOgre * @copyright 2026 CleverOgre
* @license GLP-3.0-or-later * @license GLP-3.0-or-later
* @version 1.1.0 * @version 1.1.0
* @since 1.1.0 * @since 1.1.0
@@ -53,7 +53,7 @@ final class Refresh {
} }
public function handle_notices():void { public function handle_notices():void {
if (!current_user_can(self::CAPABILITY) || $_GET['page'] != Plugin::get_id() || !isset($_GET[self::ACTION])) return; if (!current_user_can(self::CAPABILITY) || !isset($_GET['page']) || $_GET['page'] != Plugin::get_id() || !isset($_GET[self::ACTION])) return;
printf( printf(
'<div class="notice notice-success is-dismissable"><p>%s</p></div>', '<div class="notice notice-success is-dismissable"><p>%s</p></div>',
Plugin::esc_html__('All sort relationships successfully refreshed!') Plugin::esc_html__('All sort relationships successfully refreshed!')

View File

@@ -2,9 +2,9 @@
/** /**
* @package ogre-sort * @package ogre-sort
* @author cleverogre * @author cleverogre
* @copyright 2025 CleverOgre * @copyright 2026 CleverOgre
* @license GLP-3.0-or-later * @license GLP-3.0-or-later
* @version 1.0.0 * @version 1.1.1
* @since 1.0.0 * @since 1.0.0
*/ */
@@ -196,12 +196,13 @@ final class Settings {
echo implode('<br>', array_map( echo implode('<br>', array_map(
fn (object $option):string => sprintf( fn (object $option):string => sprintf(
'<label><input type="checkbox" name="%s[%s][]" value="%s" %s>&nbsp;%s</label>', '<label><input type="checkbox" name="%s[%s][]" value="%s" %s>&nbsp;%s (%s)</label>',
esc_attr(Plugin::get_id()), esc_attr(Plugin::get_id()),
esc_attr($name), esc_attr($name),
esc_attr($option->name), esc_attr($option->name),
checked($this->is_checked($name, $option->name), display: false), checked($this->is_checked($name, $option->name), display: false),
esc_html($option->label) esc_html($option->label),
esc_html($option->name)
), ),
$options $options
)); ));

View File

@@ -4,7 +4,7 @@
* @author cleverogre * @author cleverogre
* @copyright 2025 CleverOgre * @copyright 2025 CleverOgre
* @license GLP-3.0-or-later * @license GLP-3.0-or-later
* @version 1.0.0 * @version 1.1.0
* @since 1.0.0 * @since 1.0.0
*/ */
@@ -300,17 +300,18 @@ final class Sort {
foreach ($wp_query->query['tax_query'] as $tax) { foreach ($wp_query->query['tax_query'] as $tax) {
if (!isset($tax['taxonomy'])) continue; if (!isset($tax['taxonomy'])) continue;
if ($current_relationship['taxonomy'] != $tax['taxonomy']) continue; if ($current_relationship['taxonomy'] != $tax['taxonomy']) continue;
$term_by = $tax['field']; $term_by = $tax['field'] ?? 'term_id';
$term_id = $tax['terms']; $term_id = $tax['terms'];
break; break;
} }
} else if ($current_relationship['taxonomy'] === 'category' && isset($wp_query->query['category_name'])) { } else if ($current_relationship['taxonomy'] === 'category' && isset($wp_query->query['category_name'])) {
$term_id = $wp_query->query['category_name']; $term_id = $wp_query->query['category_name'];
} }
if (empty($term_id)) break; if (is_array($term_id)) $term_id = array_values($term_id)[0];
if (empty($term_id)) return;
$term = get_term_by($term_by, $term_id, $current_relationship['taxonomy']); $term = get_term_by($term_by, $term_id, $current_relationship['taxonomy']);
if (!is_a($term, 'WP_Term')) break; if (!is_a($term, 'WP_Term')) return;
$wp_query->set('meta_key', "ogre-sort_{$current_relationship['taxonomy']}_{$term->term_id}"); $wp_query->set('meta_key', "ogre-sort_{$current_relationship['taxonomy']}_{$term->term_id}");
$wp_query->set('orderby', 'meta_value_num'); $wp_query->set('orderby', 'meta_value_num');

View File

@@ -4,16 +4,16 @@
* *
* @package ogre-sort * @package ogre-sort
* @author cleverogre * @author cleverogre
* @copyright 2025 CleverOgre * @copyright 2026 CleverOgre
* @license GLP-3.0-or-later * @license GLP-3.0-or-later
* @version 1.0.0 * @version 1.1.1
* @since 1.0.0 * @since 1.0.0
* *
* @wordpress-plugin * @wordpress-plugin
* Plugin Name: Ogre Sort * Plugin Name: Ogre Sort
* Plugin URI: https://plugins.cleverogre.com/plugin/ogre-sort/ * Plugin URI: https://plugins.cleverogre.com/plugin/ogre-sort/
* Description: WordPress plugin which enables drag-and-drop sorting within the admin area for posts, terms, and posts within terms. * Description: WordPress plugin which enables drag-and-drop sorting within the admin area for posts, terms, and posts within terms.
* Version: 1.0.0 * Version: 1.1.1
* Requires at least: 5.0 * Requires at least: 5.0
* Requires PHP: 8.0 * Requires PHP: 8.0
* Author: CleverOgre * Author: CleverOgre

16
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "cleverogre/ogre-sort", "name": "cleverogre/ogre-sort",
"version": "1.0.0", "version": "1.1.0",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "cleverogre/ogre-sort", "name": "cleverogre/ogre-sort",
"version": "1.0.0", "version": "1.1.0",
"license": "GPL-3.0+", "license": "GPL-3.0+",
"devDependencies": { "devDependencies": {
"gulp": "^5.0.0", "gulp": "^5.0.0",
@@ -57,9 +57,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/@types/node": { "node_modules/@types/node": {
"version": "24.10.1", "version": "25.0.10",
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.1.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-25.0.10.tgz",
"integrity": "sha512-GNWcUTRBgIRJD5zj+Tq0fKOJ5XZajIiBroOF0yvj2bSU1WvNdYS/dn9UxwsujGW4JX06dnHyjV2y9rRaybH0iQ==", "integrity": "sha512-zWW5KPngR/yvakJgGOmZ5vTBemDoSqF3AcV/LrO5u5wTWyEAVVh+IT39G4gtyAkh3CtTZs8aX/yRM82OfzHJRg==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -1400,9 +1400,9 @@
} }
}, },
"node_modules/fastq": { "node_modules/fastq": {
"version": "1.19.1", "version": "1.20.1",
"resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.1.tgz", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.20.1.tgz",
"integrity": "sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==", "integrity": "sha512-GGToxJ/w1x32s/D2EKND7kTil4n8OVk/9mycTc4VDza13lOvpUZTGX3mFSCtV9ksdGBVzvsyAVLM6mHFThxXxw==",
"dev": true, "dev": true,
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {

View File

@@ -1,7 +1,7 @@
{ {
"$schema": "https://www.schemastore.org/package.json", "$schema": "https://www.schemastore.org/package.json",
"name": "cleverogre/ogre-sort", "name": "cleverogre/ogre-sort",
"version": "1.0.0", "version": "1.1.1",
"title": "Ogre Sort", "title": "Ogre Sort",
"description": "WordPress plugin which enables drag-and-drop sorting within the admin area for posts, terms, and posts within terms.", "description": "WordPress plugin which enables drag-and-drop sorting within the admin area for posts, terms, and posts within terms.",
"author": "CleverOgre", "author": "CleverOgre",

View File

@@ -3,7 +3,7 @@ Contributors: ogrecooper, cleverogre
Tested up to: 6.8 Tested up to: 6.8
Requires at least: 5.0 Requires at least: 5.0
Requires PHP: 8.0 Requires PHP: 8.0
Version: 1.0.0 Version: 1.1.1
License: GPLv3 or later License: GPLv3 or later
License URI: https://www.gnu.org/licenses/gpl-3.0.html License URI: https://www.gnu.org/licenses/gpl-3.0.html
Copyright: CleverOgre Copyright: CleverOgre
@@ -28,5 +28,13 @@ If you don't know what plugin you have downloaded, please contact [CleverOgre](t
== Changelog == == Changelog ==
= 1.1.1 - 2026-02-03 =
* Add name slugs to admin UI
* Fix undefined array key notice
= 1.1.0 - 2026-01-21 =
* Add manual refresh action
* Fix filtering issue during refresh
= 1.0.0 - 2025-11-18 = = 1.0.0 - 2025-11-18 =
* Initial release * Initial release