-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(corrections): add corrections and clarifications behind feature …
…flag (#3638) This PR adds the corrections feature behind the `NEWSPACK_CORRECTIONS_ENABLED` feature flag. Note this is a quick and simple implementation based on an already existing custom plugin strictly for the purpose of getting ready for a site migration.
- Loading branch information
1 parent
0ed8bd8
commit ea745cf
Showing
5 changed files
with
666 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Corrections | ||
|
||
This feature allows authors to add article corrections to the top or bottom of a post. | ||
|
||
## How it works | ||
|
||
When you enable this feature, a new meta box will be added to the post editor screen. You can use this meta box to add a correction to the post. The correction will be displayed at the top or bottom of the post, depending on the settings. | ||
|
||
## Usage | ||
|
||
This feature can be enabled by adding the following constant to your `wp-config.php`: | ||
|
||
```php | ||
define( 'NEWSPACK_CORRECTIONS_ENABLED', true ); | ||
``` | ||
|
||
## Data | ||
|
||
Corrections are stored as `newspack_correction` custom post type. A correction consists of the following fields: | ||
|
||
| Name | Type | Stored As | Description | | ||
| ----------------------------- | -------- | -------------- | --------------------------------------------------------------- | | ||
| `title` | `string` | `post_title` | The correction title. Defaults to 'Correction for [post title]' | | ||
| `content` | `string` | `post_content` | The correction text. | | ||
| `date` | `string` | `post_date` | The date assigned to the correction. | | ||
| `newspack_correction-post-id` | `int` | `post_meta` | The ID of the post to which the correction is associated. | | ||
|
||
In addition, some correction data is stored in the associated post as post meta: | ||
|
||
| Name | Type | Stored As | Description | | ||
| ------------------------------- | ----------------------- | ----------- | ------------------------------------------------------------- | | ||
| `newspack_corrections_active` | `bool` | `post_meta` | Whether the feature is enabled for the post. | | ||
| `newspack_corrections_location` | `string` | `post_meta` | Where the correction should be displayed. (`top` or `bottom`) | | ||
| `newspack_corrections_ids` | `array` | `post_meta` | An array of IDs of the corrections associated with the post. | |
Oops, something went wrong.