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 alpha 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.
23
+
> 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)
9
24
10
25
---
11
26
@@ -26,6 +41,11 @@ HWP Previews is a robust and extensible WordPress plugin that centralizes all pr
26
41
It empowers site administrators and developers to tailor preview behaviors for each public post type independently, facilitating seamless headless or decoupled workflows.
27
42
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.
28
43
44
+
45
+
46
+
>[!IMPORTANT]
47
+
> For Faust users, HWP Previews integrates seamlessly, automatically configuring settings to match Faust's preview system. This allows you to maintain your existing preview workflow without additional setup.
48
+
29
49
---
30
50
31
51
## Features
@@ -34,8 +54,8 @@ With HWP Previews, you can define dynamic URL templates, enforce unique slugs fo
34
54
-**Custom URL Templates**: Define preview URLs using placeholder tokens for dynamic content.
35
55
-**Parent Status**: Allow posts of **all** statuses to be used as parent within hierarchical post types.
36
56
-**Highly Customizable**: Extend core behavior with a comprehensive set of actions and filters.
57
+
-**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).
37
58
38
-
---
39
59
40
60
## Getting Started
41
61
@@ -49,6 +69,28 @@ This guide will help you set up your first headless preview link for the "Posts"
│ ├── Plugin.php # Main plugin class (entry point)
82
+
│ └── Autoload.php # PSR-4 autoloader
83
+
├── tests/ # All test suites
84
+
│ ├── wpunit/ # WPBrowser/Codeception unit
85
+
├── [hwp-previews.php]
86
+
├── [activation.php]
87
+
├── [composer.json]
88
+
├── [deactivation.php]
89
+
├── [ACTIONS_AND_FILTERS.md]
90
+
├── [TESTING.md]
91
+
├── [README.md]
92
+
```
93
+
52
94
## Configuration
53
95
54
96
HWP Previews configuration located at **Settings > HWP Previews** page in your WP Admin. The settings are organized by post type.
@@ -114,11 +156,7 @@ This out-of-the-box configuration allows your existing preview workflow to conti
114
156
115
157
---
116
158
117
-
## Extending the Functionality
118
-
119
-
The plugin's behavior can be extended using its PHP hooks. Developers can control which post types are configurable in the settings via the `hwp_previews_filter_available_post_types` filter. The `hwp_previews_core` action allows for registering new URL parameters or unregistering default ones. Additionally, the `hwp_previews_template_path` filter can be used to replace the default preview iframe with a custom PHP template.
120
-
121
-
### Actions & Filters
159
+
## Actions & Filters
122
160
123
161
See the [Actions & Filters documentation](ACTIONS_AND_FILTERS.md) for a comprehensive list of available hooks and how to use them.
124
162
@@ -127,3 +165,28 @@ See the [Actions & Filters documentation](ACTIONS_AND_FILTERS.md) for a comprehe
127
165
## Testing
128
166
129
167
See [Testing.md](TESTING.md) for details on how to test the plugin.
168
+
169
+
170
+
## Screenshots
171
+
172
+
<details>
173
+
<summary>Click to expand screenshots</summary>
174
+
175
+

176
+
*Preview settings page.*
177
+
178
+

179
+
*Preview settings for a custom post type.*
180
+
181
+

182
+
*Preview button in the WordPress editor.*
183
+
184
+

185
+
*Preview loaded inside the WordPress editor using an iframe.*
186
+
187
+

188
+
*Preview token parameter for secure preview URLs.*
> You can also add coverage e.g. `sh bin/local/run-unit-tests.sh coverage --coverage-html` and the output will be saved in [tests/_output/coverage/dashboard.html](tests/_output/coverage/dashboard.html)
78
73
79
-
Run functional tests (simulate web requests):
80
74
81
-
```bash
82
-
composer run test:functional
83
-
# or
84
-
vendor/bin/codecept run functional
85
-
```
86
-
87
-
### Acceptance Tests
75
+
### E2WTests
88
76
89
77
Run browser-based acceptance tests:
90
78
91
79
```bash
92
-
composer run test:acceptance
93
-
# or
94
-
vendor/bin/codecept run acceptance
80
+
sh bin/local/run-e2e-tests.sh coverage
95
81
```
96
82
97
83
### All Tests
@@ -142,13 +128,7 @@ tests/
142
128
├── _envs/ # Environment configs
143
129
├── _output/ # Test output (logs, coverage)
144
130
├── _support/ # Helper classes, modules
145
-
├── acceptance/ # Acceptance test cases
146
-
├── functional/ # Functional test cases
147
-
├── unit/ # Unit test cases
148
131
├── wpunit/ # WPUnit (WordPress-aware unit/integration) test cases
0 commit comments