You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> This plugin is currently in an beta state. It's still under active development, so you may encounter bugs or incomplete features. Updates will be rolled out regularly. Use with caution and provide feedback if possible. You can create an issue at [https://github.com/wpengine/hwptoolkit/issues](https://github.com/wpengine/hwptoolkit/issues)
24
+
> This plugin is currently in a beta state. It's still under active development, so you may encounter bugs or incomplete features. Updates will be rolled out regularly. Use with caution and provide feedback if possible. You can create an issue at [https://github.com/wpengine/hwptoolkit/issues](https://github.com/wpengine/hwptoolkit/issues)
25
25
26
26
---
27
27
@@ -40,7 +40,7 @@
40
40
41
41
HWP Previews is a robust and extensible WordPress plugin that centralizes all preview configurations into a user-friendly settings interface.
42
42
It empowers site administrators and developers to tailor preview behaviors for each public post type independently, facilitating seamless headless or decoupled workflows.
43
-
With HWP Previews, you can define dynamic URL templates, enforce unique slugs for drafts, allow all post statuses be used as parent and extend functionality through flexible hooks and filters, ensuring a consistent and conflict-free preview experience across diverse environments.
43
+
With HWP Previews, you can define dynamic URL templates, allow posts of all statuses to be used as parents, and extend functionality through flexible hooks and filters, ensuring a consistent and conflict-free preview experience across diverse environments.
44
44
45
45
46
46
@@ -53,7 +53,7 @@ With HWP Previews, you can define dynamic URL templates, enforce unique slugs fo
53
53
54
54
-**Enable/Disable Previews**: Turn preview functionality on or off for each public post type (including custom types).
55
55
-**Custom URL Templates**: Define preview URLs using placeholder tokens for dynamic content.
56
-
-**Parent Status**: Allow posts of **all** statuses to be used as parent within hierarchical post types.
56
+
-**Parent Status**: Allow posts of **all** statuses to be used as parents within hierarchical post types.
57
57
-**Highly Customizable**: Extend core behavior with a comprehensive set of actions and filters.
58
58
-**Faust Compatibility**: The plugin is compatible with [Faust.js](https://faustjs.org/) and the [FaustWP plugin](https://github.com/wpengine/faustjs/tree/canary/plugins/faustwp).
59
59
@@ -64,9 +64,9 @@ This guide will help you set up your first headless preview link for the "Posts"
64
64
65
65
1.**Activate the Plugin:** Ensure "HWP Previews" is installed and activated.
66
66
2.**Navigate to Settings:** Go to **Settings > HWP Previews** in your WordPress admin dashboard.
67
-
3.**Enable for Posts:** On the "Posts" tab check the "Enable HWP Previews" box. If you have Faust installed this option will be enabled by default. Find more information about Faust integration below.
67
+
3.**Enable for Posts:** On the "Posts" tab, check the "Enable HWP Previews" box. If you have Faust installed, this option will be enabled by default. Find more information about Faust integration below.
68
68
4.**Set the Preview URL:** In the "Preview URL Template" field for Posts, enter the URL for your front-end application's preview endpoint. Use parameters to add dynamic information that you want to access.
69
-
5.**Save and Test:** Save changes and go to any post, make a change, and click the "Preview" button. You should be redirected to the URL you just configured.
69
+
5.**Save and Test:** Save changes, go to any post, make a change, and click the "Preview" button. You should be redirected to the URL you just configured.
│ ├── Plugin.php # Main plugin class (entry point)
83
83
│ └── Autoload.php # PSR-4 autoloader
84
+
├── examples/ # Example front-end integrations for WP GraphQL and REST
84
85
├── tests/ # All test suites
85
-
│ ├── wpunit/ # WPBrowser/Codeception unit
86
-
├── [hwp-previews.php]
87
-
├── [activation.php]
88
-
├── [composer.json]
89
-
├── [deactivation.php]
90
-
├── [ACTIONS_AND_FILTERS.md]
91
-
├── [TESTING.md]
92
-
├── [README.md]
86
+
│ ├── wpunit/ # WPBrowser/Codeception unit
87
+
├── hwp-previews.php
88
+
├── activation.php
89
+
├── composer.json
90
+
├── deactivation.php
91
+
├── ACTIONS_AND_FILTERS.md
92
+
├── TESTING.md
93
+
├── README.md
93
94
```
94
95
95
96
## Configuration
@@ -101,12 +102,12 @@ HWP Previews configuration located at **Settings > HWP Previews** page in your W
101
102
For each public post type, you can configure:
102
103
103
104
-**Enable HWP Previews:** This is the master switch for the post type. If disabled, WordPress will revert to its default preview behavior for these posts.
104
-
-**Allow All Statuses as Parent:** This option is only available for Pages type. By default, WordPress only allows published posts to be parents. Enable this to build parent-child relationships using draft or pending posts.
105
+
-**Allow All Statuses as Parent:** This option is only available for hierarchical post types like Pages. By default, WordPress only allows published posts to be parents. Enable this to build parent-child relationships using draft or pending posts.
105
106
-**Load Previews in Iframe:** When enabled, the preview will be displayed directly within the WordPress editor in a sandboxed `<iframe>`. This provides a more integrated experience but requires your front-end to be configured to allow embedding. If disabled, clicking "Preview" will open a new browser tab.
106
-
-**Preview URL:** You will be redirected to this link, whenever you click the preview button for the enabled post type.
107
+
-**Preview URL:** You will be redirected to this link whenever you click the preview button for the enabled post type.
107
108
108
109
> [!NOTE]
109
-
> Retrieving of settings is cached for performance.
110
+
> Retrieval of settings is cached for performance.
110
111
111
112
### Parameters
112
113
@@ -132,7 +133,9 @@ Default post statuses are `publish`, `future`, `draft`, `pending`, `private`, `a
132
133
133
134
HWP Previews is framework and API agnostic, meaning you can integrate it with any front-end application and with any data-fetching method (WPGraphQL, REST).
134
135
135
-
To get started quickly you can use our [example based on Next.js and WPGraphQL](https://github.com/wpengine/hwptoolkit/tree/main/examples/next/hwp-preview-wpgraphql). This example uses the Draft Mode feature of Next.js.
136
+
To get started quickly you can use our [example based on Next.js and WPGraphQL](https://github.com/wpengine/hwptoolkit/tree/main/plugins/hwp-previews/examples/hwp-preview-wpgraphql). This example uses the Draft Mode feature of Next.js.
137
+
138
+
For REST users, you can follow our example [here](https://github.com/wpengine/hwptoolkit/tree/main/plugins/hwp-previews/examples/hwp-preview-rest) with Next.js App Router.
136
139
137
140
To implement your own approach from scratch you can refer to the appropriate documentation pages for each framework. HWP Previews relies on custom preview URLs, allowing you to integrate any method. Below you can find the guides to implement framework-specific preview mode.
$this->assertInstanceOf( Settings_Page::class, $instance, 'Settings_Page::init() should return an instance for users with manage_options capability.' );
0 commit comments