@domenico
To include a JSON manifest file in a WordPress theme, you can follow these steps:
1 2 3 4 5 |
{ "main.css": "path/to/main.css", "script.js": "path/to/script.js", "image.jpg": "path/to/image.jpg" } |
1 2 3 4 |
function enqueue_manifest() { wp_enqueue_script( 'theme-manifest', get_stylesheet_directory_uri() . '/assets/manifest.json' , array(), null, true ); } add_action( 'wp_enqueue_scripts', 'enqueue_manifest' ); |
1
|
<link rel="stylesheet" href="<?php echo theme_manifest['main.css'] ?>"> |
Make sure to replace theme_manifest
with the actual variable name you use in your theme.
By following these steps, you can include a JSON manifest file in your WordPress theme and easily access and update your assets throughout the theme.