Note: This page is about WordPress templates, not the pre-made templates used in the Gust page builder. For more details on those, see the templates section in page builder docs or browse our templates.
When you're building a WordPress site you will often need to edit or create templates. WordPress comes with some standard templates such as index.php
, single.php
, home.php
and the list goes on. The good news is that if you are developing these you can still make use of Tailwind to ensure that the class names you use there are included in your final stylesheet.
Gust will automatically scan the following files in your child theme:
If you want Gust to watch out for any other templates you might be using, you can add them through the gust_safelist_templates
filter. These should be relative to your theme directory as Gust will use locate_template
under the hood to find them. If you have any other files that you want Gust to watch, pass them in using the gust_safelist_files
filter, with the full path to the file.
You will need to trigger a manual rebuild of the stylesheet if you change any templates. To do that go to the Gust settings from the dashboard and click "Rebuild CSS".
Here are two examples of whitelisting files for Gust to watch:
// adds child-theme/templates/my-custom-template.php
function include_child_theme_files( $files ){
$files[] = 'templates/my-custom-template.php';
return $files;
}
add_filter( 'gust_safelist_templates', 'include_child_theme_files' );
function include_other_file( $files ){
$files[] = trailingslashit( wp_upload_dir() ) . 'some-other-file.php';
}
add_filter( 'gust_safelist_files', 'include_other_file' );
If you want to hard-code some class names so that they are always included, you can do so by using the gust_safelist
filter. Class names returned from this filter will always be included in your final build.
When you're developing your PHP templates, you'll want to be able to see the changes you make displayed on the front-end, but it's time consuming to trigger a re-build every time. To speed up the process, Gust allows you to enable Developer Mode from the Gust settings. Turning this on will re-compile Tailwind on every page load. Note that this only runs for admins. You should always turn this off when you're done, and trigger a rebuild ( as above ), but if you accidentally leave it on, it won't run for your regular users.