From 507d5af7467ddc518d5747ae4cba6ab0bbc54cb4 Mon Sep 17 00:00:00 2001 From: gustavo Date: Mon, 14 Jul 2025 08:13:44 +0000 Subject: [PATCH] nestor --- .gitattributes | 4 ++ .github/PULL_REQUEST_TEMPLATE.md | 35 +++++++++++++++ .github/workflows/test.yml | 76 ++++++++++++++++++++++++++++++++ .gitignore | 4 ++ composer.json | 4 +- src/StarterSite.php | 33 +++++++------- style.css | 4 +- 7 files changed, 141 insertions(+), 19 deletions(-) create mode 100644 .gitattributes create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/workflows/test.yml create mode 100644 .gitignore diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..2e1912c --- /dev/null +++ b/.gitattributes @@ -0,0 +1,4 @@ +/.gitattributes export-ignore +/.github export-ignore +/tests export-ignore +/phpunit.xml \ No newline at end of file diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..626a6ed --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,35 @@ + + + + +Related: + +- Ticket 1 +- Ticket 2 + +## Issue + + + +## Solution + + + +## Impact + + + +## Usage Changes + + +## Considerations + + + +## Testing + diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..f949e1e --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,76 @@ +name: Timber starter theme tests + +on: + push: + branches: + - '1.x' + - '2.x' + pull_request: + types: + - opened + - synchronize + - ready_for_review + +# Cancel previous workflow run groups that have not completed. +concurrency: + # Group workflow runs by workflow name, along with the head branch ref of the pull request + # or otherwise the branch or tag ref. + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.ref }} + cancel-in-progress: true + +jobs: + phpunit: + runs-on: ubuntu-latest + + continue-on-error: ${{ matrix.experimental }} + strategy: + fail-fast: false + matrix: + php: ['8.1', '8.2'] + wp: ['latest'] + multisite: ['0', '1'] + extensions: ['gd'] + experimental: [false] + include: + # PHP 8.2 / experimental + - php: '8.2' + wp: 'trunk' + dependency-version: 'highest' + multisite: '0' + experimental: true + # PHP 8.3 / experimental + - php: '8.3' + wp: 'trunk' + dependency-version: 'highest' + multisite: '0' + experimental: true + # Coverage + - php: '8.1' + wp: 'latest' + dependency-version: 'highest' + multisite: '0' + experimental: false + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + tools: composer:v2 + extensions: curl, date, dom, iconv, json, libxml, gd + + - name: Setup problem matchers for PHP + run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" + + - name: Setup problem matchers for PHPUnit + run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + + - uses: ramsey/composer-install@v3 + + - name: Run tests + run: composer run test + env: + WP_MULTISITE: ${{ matrix.multisite }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9477bf3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +/composer.lock +/vendor/ +/wordpress/ +.phpunit.result.cache \ No newline at end of file diff --git a/composer.json b/composer.json index 1e1dcd5..3c08429 100644 --- a/composer.json +++ b/composer.json @@ -36,7 +36,9 @@ } ], "require": { - "timber/timber": "^2.1" + "timber/timber": "^2.1", + "illuminate/collections": "^12.20", + "twbs/bootstrap": "^5.3" }, "require-dev": { "automattic/wordbless": "^0.4.2", diff --git a/src/StarterSite.php b/src/StarterSite.php index 834eaad..57ef329 100644 --- a/src/StarterSite.php +++ b/src/StarterSite.php @@ -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'; diff --git a/style.css b/style.css index 90afb39..2484216 100644 --- a/style.css +++ b/style.css @@ -1,5 +1,5 @@ /* - * Theme Name: My Timber 2.x Starter Theme - * Description: Starter Theme to use with Timber + * Theme Name: CNT Sindiaktua + * Description: Tema Timber de nexos * Author: Timber Team and You! */