Skip to content

Commit f1a9d1e

Browse files
authored
Merge pull request #5 from torounit/fix/ui
Clarify term scheduling UI labels and expand README
2 parents 2ef9ce6 + 8de799d commit f1a9d1e

6 files changed

Lines changed: 58 additions & 21 deletions

File tree

.wordpress-org/icon.svg

Lines changed: 14 additions & 0 deletions
Loading

README.md

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,37 @@ Automatically set and unset the term when the time is up.
1414

1515
## Description
1616

17-
Automatically set and unset the term when the time is up.
17+
Schedule Terms lets you reserve a date and time for a category, tag, or any other taxonomy term to be attached to or detached from a post, instead of editing the post manually when the time comes.
18+
19+
It's useful for things like:
20+
21+
* Featuring a post in a "Sale" or "Campaign" category only during a specific period, and removing it automatically afterwards.
22+
* Adding a "New" tag to a post for a limited time after publishing.
23+
* Hiding a post from a "Featured" listing taxonomy once a promotion ends.
1824

19-
Check the "use schedule" checkbox in the category or tag management screen. You can set a time for each post to be added or removed from the category or tag.
25+
Once scheduling is enabled for a taxonomy, a "Schedule Terms" panel appears in the post editor for every term in that taxonomy, with separate "Attach" and "Detach" date/time fields. WordPress' own cron system checks the schedule and updates the post's terms automatically when the time arrives, so there's nothing else to do once a schedule is set.
2026

2127
### Usage
2228

23-
1. Go to category,tag or custom taxonomy management screen.
24-
2. Check the "Use scheduling" checkbox.
25-
3. Goto edit post screen then set datetime in "Schedule Terms" panel.
29+
1. Go to the category, tag, or custom taxonomy management screen.
30+
2. Check the "Enable scheduling" checkbox when adding or editing a term (or via Quick Edit) to turn scheduling on for that term.
31+
3. Open a post in the block editor and find the "Schedule Terms" panel in the document sidebar.
32+
4. Set the "Attach" date/time to have the term automatically added to the post at that time, and/or the "Detach" date/time to have it automatically removed.
33+
5. Save or update the post. The term will be attached/detached automatically once the scheduled time passes.
34+
35+
### FAQ
36+
37+
**Does the term get attached/detached even if I don't edit the post again?**
38+
39+
Yes. Scheduling is handled by WordPress cron, so the post doesn't need to be opened or saved again after the schedule is set.
40+
41+
**What happens if I leave both the "Attach" and "Detach" fields empty?**
42+
43+
Nothing is scheduled for that term on that post; the term is only added or removed when you do so manually, as usual.
44+
45+
**Can I use this with a custom taxonomy?**
46+
47+
Yes, scheduling can be enabled for any taxonomy that is shown in the admin UI (`show_ui` is true), not just categories and tags.
2648

2749
## Screenshots
2850

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
2-
"name": "hamworks/schedule-terms",
2+
"name": "torounit/schedule-terms",
33
"license": "GPL-2.0-or-later",
44
"authors": [
55
{
66
"name": "Hiroshi Urabe",
7-
"email": "urabe@ham.works"
7+
"email": "mail@torounit.com"
88
}
99
],
1010
"require": {

includes/Term_UI.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class Term_UI extends UI {
4444
public function __construct( $file, string $meta_key ) {
4545
$this->meta_key = $meta_key;
4646
$this->labels = array(
47-
'singular' => esc_html__( 'Use scheduling', 'schedule-posts' ),
47+
'singular' => esc_html__( 'Enable scheduling', 'schedule-posts' ),
4848
);
4949

5050
parent::__construct( $file );
@@ -103,14 +103,15 @@ protected function form_field( $term = null ) {
103103
: '';
104104

105105
?>
106-
<input
107-
type="checkbox"
108-
name="term-<?php echo esc_attr( $this->meta_key ); ?>"
109-
id="term-<?php echo esc_attr( $this->meta_key ); ?>"
110-
<?php checked( (bool) $value, true, true ); ?>
111-
/>
106+
112107
<label for="term-<?php echo esc_attr( $this->meta_key ); ?>">
113-
<?php esc_html_e( 'Use automatic term attach / detach.', 'schedule-posts' ); ?>
108+
<input
109+
type="checkbox"
110+
name="term-<?php echo esc_attr( $this->meta_key ); ?>"
111+
id="term-<?php echo esc_attr( $this->meta_key ); ?>"
112+
<?php checked( (bool) $value, true, true ); ?>
113+
/>
114+
<?php esc_html_e( 'Automatically attach or detach this term on schedule.', 'schedule-posts' ); ?>
114115
</label>
115116
<?php
116117
}
@@ -121,7 +122,7 @@ protected function form_field( $term = null ) {
121122
protected function quick_edit_form_field() {
122123
?>
123124
<input type="checkbox" name="term-<?php echo esc_attr( $this->meta_key ); ?>">
124-
<?php esc_html_e( 'Use automatic term attach / detach.', 'schedule-posts' ); ?>
125+
<?php esc_html_e( 'Automatically attach or detach this term on schedule.', 'schedule-posts' ); ?>
125126
<?php
126127
}
127128
}

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"name": "@hamworks/schedule-terms",
2+
"name": "@torounit/schedule-terms",
33
"version": "1.3.2",
44
"private": true,
5-
"author": "HIroshi Urabe <mail@torounit.com> (https://torounit.com)",
5+
"author": "Hiroshi Urabe <mail@torounit.com> (https://torounit.com)",
66
"license": "GPL-2.0+",
77
"scripts": {
88
"wp-env": "wp-env",
@@ -22,7 +22,7 @@
2222
},
2323
"repository": {
2424
"type": "git",
25-
"url": "https://github.com/team-hamworks/schedule-terms.git"
25+
"url": "https://github.com/torounit/schedule-terms.git"
2626
},
2727
"devDependencies": {
2828
"@wordpress/scripts": "^32.4.1",

schedule-terms.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?php
22
/**
33
* Plugin Name: Schedule Terms
4-
* Plugin URI: https://github.com/hamworks/schedule-terms
4+
* Plugin URI: https://github.com/torounit/schedule-terms
55
* Description: Automatically set and unset the term when the time is up.
66
* Author: Toro_Unit, HAMWORKS
7-
* Author URI: https://ham.works
7+
* Author URI: https://torounit.com/
88
* License: GPLv2 or later
99
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
1010
* Text Domain: schedule-terms

0 commit comments

Comments
 (0)