Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 735a4c3038 | |||
|
|
37572b5a8a | ||
|
|
681e2ed152 | ||
|
|
79fff56a25 | ||
|
|
06485c47b2 |
@@ -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
1
.gitignore
vendored
@@ -2,3 +2,4 @@ vendor
|
|||||||
lib
|
lib
|
||||||
node_modules
|
node_modules
|
||||||
*.zip
|
*.zip
|
||||||
|
dist
|
||||||
|
|||||||
25
.vscode/sftp.json
vendored
25
.vscode/sftp.json
vendored
@@ -1,25 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "acornfinehomes.com",
|
|
||||||
"host": "og6.cleverogre.com",
|
|
||||||
"protocol": "sftp",
|
|
||||||
"port": 22,
|
|
||||||
"username": "acornfinehomes",
|
|
||||||
"password": "kwSSrK7nkV3J54nV2E7XcjHH",
|
|
||||||
"privateKeyPath": "~/.ssh/id_rsa",
|
|
||||||
"remotePath": "/home/acornfinehomes/htdocs/acornfinehomes.com/wp-content/plugins/ogre-sort/",
|
|
||||||
"uploadOnSave": true,
|
|
||||||
"useTempFile": false,
|
|
||||||
"openSsh": false,
|
|
||||||
"ignore": [
|
|
||||||
".vscode",
|
|
||||||
".git",
|
|
||||||
".DS_Store",
|
|
||||||
".gitignore",
|
|
||||||
"composer.json",
|
|
||||||
"composer.lock",
|
|
||||||
"gulpfile.js",
|
|
||||||
"Makefile",
|
|
||||||
"package-lock.json",
|
|
||||||
"package.json"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
44
gulpfile.js
44
gulpfile.js
@@ -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'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -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');
|
||||||
|
|||||||
Reference in New Issue
Block a user