This commit is contained in:
2025-07-14 08:13:44 +00:00
parent 6b74ca3b96
commit 507d5af746
7 changed files with 141 additions and 19 deletions

View File

@ -17,16 +17,13 @@ use Twig\TwigFilter;
*/
class StarterSite extends Site {
/**
* StarterSite constructor.
*/
public function __construct() {
add_action( 'after_setup_theme', [ $this, 'theme_supports' ] );
add_action( 'init', [ $this, 'register_post_types' ] );
add_action( 'init', [ $this, 'register_taxonomies' ] );
add_action('wp_enqueue_scripts', [$this,'load_assets']);
add_filter( 'timber/context', [ $this, 'add_to_context' ] );
add_filter( 'timber/twig/filters', [ $this, 'add_filters_to_twig' ] );
add_filter( 'timber/twig/functions', [ $this, 'add_functions_to_twig' ] );
@ -35,21 +32,25 @@ class StarterSite extends Site {
parent::__construct();
}
/**
* This is where you can register custom post types.
*/
function load_assets() {
$version = 4;
// $version_for_app = $version;
$version_for_app = time();
wp_enqueue_style( 'twbs', get_template_directory_uri() . '/vendor/twbs/bootstrap/dist/css/bootstrap.min.css', [], $version, 'all');
wp_enqueue_style( 'twbsi', get_template_directory_uri() . '/vendor/twbs/bootstrap-icons/font/bootstrap-icons.min.css', [], $version, 'all');
wp_enqueue_style( 'lust', get_template_directory_uri() . '/style.css', [], $version, 'all');
//~ wp_enqueue_script( 'pop', get_template_directory_uri() . '/static/popper.min.js', [], $version, false);
wp_enqueue_script( 'twbs', get_template_directory_uri() . '/vendor/twbs/bootstrap/dist/js/bootstrap.min.js', [], $version, false);
wp_enqueue_script( 'lust', get_template_directory_uri() . '/static/site.js', [], $version, false);
}
public function register_post_types() {}
/**
* This is where you can register custom taxonomies.
*/
public function register_taxonomies() {}
/**
* This is where you add some context.
*
* @param array $context context['this'] Being the Twig's {{ this }}
*/
public function add_to_context( $context ) {
$context['foo'] = 'bar';
$context['stuff'] = 'I am a value set in your functions.php file';