commit 7a1361419a63ca3fb2009dd40525297b421c744b Author: Josevi Date: Wed Jun 5 17:37:13 2024 +0000 init commit diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..a7ab1c1 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,21 @@ +# This file is for unifying the coding style for different editors and IDEs +# https://editorconfig.org/ + +# WordPress Coding Standards +# https://make.wordpress.org/core/handbook/coding-standards/ + +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true +indent_style = tab + +[*.yml] +indent_style = space +indent_size = 2 + +[*.md] +trim_trailing_whitespace = false diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..a05c212 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,57 @@ +{ + "root": true, + "ignorePatterns": [ + "*.min.js" + ], + "overrides": [ + { + "files": [ + "*.js" + ], + "extends": [ + "eslint:recommended", + "prettier" + ], + "env": { + "browser": true + }, + "parserOptions": { + "ecmaVersion": "latest" + } + }, + { + "files": [ + "*.php" + ], + "parser": "@angular-eslint/template-parser", + "plugins": [ + "php-markup", + "tailwindcss" + ], + "extends": [ + "plugin:tailwindcss/recommended" + ], + "rules": { + "tailwindcss/migration-from-tailwind-2": "off", + "tailwindcss/no-custom-classname": [ + "warn", + { + "config": "./tailwind/tailwind.config.js", + "whitelist": [ + "(page|entry|comment|wp-block|wp-element)\\-([-a-z]*)", + "vcard" + ] + } + ] + }, + "settings": { + "tailwindcss": { + "config": "./tailwind/tailwind.config.js", + "cssFiles": [ + "./theme/**/*.css" + ] + } + } + } + ] +} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f45969d --- /dev/null +++ b/.gitignore @@ -0,0 +1,20 @@ +# Ignore dependencies from npm and Composer: +/node_modules +/vendor + +# Ignore generated JavaScript files: +*.min.js + +# Ignore generated CSS files: +style.css +style-editor.css +style-editor-extra.css + +# Ignore the generated zip file: +valier.zip + +# Ignore .DS_Store files from macOS: +.DS_Store +/node_scripts/ +/composer.lock +/package-lock.json diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..03d9549 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..30cd87b --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/php.xml b/.idea/php.xml new file mode 100644 index 0000000..f324872 --- /dev/null +++ b/.idea/php.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/valier.iml b/.idea/valier.iml new file mode 100644 index 0000000..c956989 --- /dev/null +++ b/.idea/valier.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..3bc7b62 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,10 @@ +# Ignore all files: +*.* + +# Negate the above pattern for CSS files in the `tailwind` folder and for +# all JavaScript files: +!tailwind/**/*.css +!*.js + +# Ignore minified JavaScript: +*.min.js diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..23cb790 --- /dev/null +++ b/LICENSE @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + {description} + Copyright (C) {year} {fullname} + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + {signature of Ty Coon}, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/README.md b/README.md new file mode 100644 index 0000000..01673ea --- /dev/null +++ b/README.md @@ -0,0 +1,55 @@ +Valier +====== + +Cumtom theme + +## Quickstart + +### Installation + +1. Move this folder to `wp-content/themes` in your local development environment +2. Run `npm install && npm run dev` in this folder +3. Activate this theme in your local WordPress installation + +### Development + +4. Run `npm run watch` +5. Add [Tailwind utility classes](https://tailwindcss.com/docs/utility-first) with abandon + +### Deployment + +6. Run `npm run bundle` +7. Upload the resulting zip file to your site using the “Upload Theme” button on the “Add Themes” administration page + +Or [deploy with the tool of your choice](https://underscoretw.com/docs/deployment/#h-other-deployment-options)! + +## Full Documentation + +### Fundamentals + +* [Installation](https://underscoretw.com/docs/installation/) + Generate your custom theme, install it in WordPress and run your first Tailwind builds +* [Development](https://underscoretw.com/docs/development/) + Watch for changes, build for production and learn more about how _tw, WordPress and Tailwind work together +* [Deployment](https://underscoretw.com/docs/deployment/) + Share your new WordPress theme with the world +* [Troubleshooting](https://underscoretw.com/docs/troubleshooting/) + Find solutions to potential issues and answers to frequently asked questions + +### In Depth + +* [Using Tailwind Typography](https://underscoretw.com/docs/tailwind-typography/) + Customize front-end and back-end typographic styles +* [JavaScript Bundling with esbuild](https://underscoretw.com/docs/esbuild/) + Install and bundle JavaScript libraries (very quickly) +* [Linting and Code Formatting](https://underscoretw.com/docs/linting-code-formatting/) + Catch bugs and stop thinking about formatting + +### Extras + +* [On Tailwind and WordPress](https://underscoretw.com/docs/wordpress-tailwind/) + Understand how WordPress and Tailwind work together +* [Managing Styles for Custom Blocks](https://underscoretw.com/docs/custom-blocks/) + Learn strategies for using Tailwind in theme-specific custom blocks +* [Setting Up Browsersync](https://underscoretw.com/docs/browsersync/) + Add live reloads and synchronized cross-device testing to your workflow diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..b0eb090 --- /dev/null +++ b/composer.json @@ -0,0 +1,22 @@ +{ + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^1.0", + "phpcompatibility/phpcompatibility-wp": "^2.1", + "sirbrillig/phpcs-changed": "^2.11", + "sirbrillig/phpcs-variable-analysis": "^2.11", + "wp-cli/i18n-command": "^2.5", + "wp-coding-standards/wpcs": "^3.0" + }, + "scripts": { + "php:lint": "vendor/bin/phpcs -p -s", + "php:lint:errors": "vendor/bin/phpcs -p -s --runtime-set ignore_warnings_on_exit 1", + "php:lint:autofix": "vendor/bin/phpcbf", + "php:lint:changed": "vendor/bin/phpcs-changed --git --git-unstaged", + "make-pot": "wp i18n make-pot . theme/languages/valier.pot" + }, + "config": { + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + } + } +} diff --git a/javascript/.eslintrc b/javascript/.eslintrc new file mode 100644 index 0000000..ad8dbb3 --- /dev/null +++ b/javascript/.eslintrc @@ -0,0 +1,5 @@ +{ + "parserOptions": { + "sourceType": "module" + } +} diff --git a/javascript/block-editor.js b/javascript/block-editor.js new file mode 100644 index 0000000..deaa964 --- /dev/null +++ b/javascript/block-editor.js @@ -0,0 +1,40 @@ +/* global wp */ + +/** + * Block editor modifications + * + * This file is loaded only by the block editor. Use it to modify the block + * editor via its APIs. + * + * The JavaScript code you place here will be processed by esbuild, and the + * output file will be created at `../theme/js/block-editor.min.js` and + * enqueued in `../theme/functions.php`. + * + * For esbuild documentation, please see: + * https://esbuild.github.io/ + */ + +/** + * This import adds your front-end post title and Tailwind Typography classes + * to the block editor. It also adds some helper classes so you can access the + * post type when modifying the block editor’s appearance. + */ +import '@_tw/typography/block-editor-classes'; + +wp.domReady(() => { + /** + * Add support for Tailwind Typography’s `lead` class via a block style. + */ + wp.blocks.registerBlockStyle('core/paragraph', { + name: 'lead', + label: 'Lead', + }); + + // Add additional block editor modifications here. For example, you could + // register another block style: + // + // wp.blocks.registerBlockStyle( 'core/quote', { + // name: 'fancy-quote', + // label: 'Fancy Quote', + // } ); +}); diff --git a/javascript/script.js b/javascript/script.js new file mode 100644 index 0000000..bd18b4b --- /dev/null +++ b/javascript/script.js @@ -0,0 +1,10 @@ +/** + * Front-end JavaScript + * + * The JavaScript code you place here will be processed by esbuild. The output + * file will be created at `../theme/js/script.min.js` and enqueued in + * `../theme/functions.php`. + * + * For esbuild documentation, please see: + * https://esbuild.github.io/ + */ diff --git a/package.json b/package.json new file mode 100644 index 0000000..78429ba --- /dev/null +++ b/package.json @@ -0,0 +1,57 @@ +{ + "private": true, + "devDependencies": { + "@_tw/themejson": "^0.2.0", + "@_tw/typography": "^0.5.12", + "@angular-eslint/template-parser": "^17.3.0", + "@tailwindcss/aspect-ratio": "^0.4.2", + "@tailwindcss/container-queries": "^0.1.1", + "@tailwindcss/forms": "^0.5.7", + "@wordpress/prettier-config": "^3.12.0", + "adm-zip": "^0.5.12", + "archiver": "^7.0.1", + "chokidar-cli": "^3.0.0", + "cross-env": "^7.0.3", + "esbuild": "^0.20.2", + "eslint": "^8.57.0", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-php-markup": "^6.0.0", + "eslint-plugin-tailwindcss": "^3.15.1", + "npm-run-all": "^4.1.5", + "postcss": "^8.4.38", + "postcss-import-ext-glob": "^2.1.1", + "prettier": "^3.2.5", + "prettier-plugin-tailwindcss": "^0.5.13", + "tailwindcss": "^3.4.3", + "touch": "^3.1.0" + }, + "scripts": { + "development:tailwind:frontend": "npx tailwindcss --postcss -i ./tailwind/tailwind.css -c ./tailwind/tailwind.config.js -o ./theme/style.css", + "development:tailwind:editor": "cross-env _TW_TARGET=editor npx tailwindcss --postcss -i ./tailwind/tailwind.css -c ./tailwind/tailwind.config.js -o ./theme/style-editor.css", + "development:tailwind:editor:extra": "cross-env _TW_TARGET=editor npx tailwindcss --postcss -i tailwind/tailwind-editor-extra.css -c ./tailwind/tailwind.config.js -o ./theme/style-editor-extra.css", + "development:esbuild": "npx esbuild ./javascript/script.js ./javascript/block-editor.js --target=esnext --bundle --outdir=./theme/js --out-extension:.js=.min.js", + "development": "run-p \"development:**\"", + "dev": "npm run development", + "watch:tailwind:frontend": "npm run development:tailwind:frontend -- --watch", + "watch:tailwind:editor": "npm run development:tailwind:editor -- --watch", + "watch:tailwind:editor:extra": "npm run development:tailwind:editor:extra -- --watch", + "watch:tailwind:themejson": "chokidar \"./theme/theme.json\" -c \"nodetouch ./tailwind/tailwind.config.js\"", + "watch:esbuild": "npm run development:esbuild -- --watch", + "watch": "run-p \"watch:**\"", + "lint:eslint": "npx eslint theme/", + "lint:prettier": "npx prettier --check .", + "lint": "run-p \"lint:*\"", + "lint-fix:eslint": "npx eslint theme/ --fix", + "lint-fix:prettier": "npx prettier --write .", + "lint-fix": "run-p \"lint-fix:*\"", + "production:tailwind:frontend": "cross-env NODE_ENV=production npm run development:tailwind:frontend -- --minify", + "production:tailwind:editor": "cross-env NODE_ENV=production npm run development:tailwind:editor -- --minify", + "production:tailwind:editor:extra": "cross-env NODE_ENV=production npm run development:tailwind:editor:extra -- --minify", + "production:esbuild": "npm run development:esbuild -- --minify", + "production": "run-p \"production:**\"", + "prod": "npm run production", + "zip": "node node_scripts/zip.js valier", + "bundle": "run-s production zip" + }, + "prettier": "@wordpress/prettier-config" +} diff --git a/phpcs.xml.dist b/phpcs.xml.dist new file mode 100644 index 0000000..9ab9cbe --- /dev/null +++ b/phpcs.xml.dist @@ -0,0 +1,89 @@ + + + + A set of rules to check for a custom WordPress theme + + + + + + + + + + + + + + + + . + + + /vendor/* + /node_modules/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/postcss.config.js b/postcss.config.js new file mode 100644 index 0000000..cf1e3be --- /dev/null +++ b/postcss.config.js @@ -0,0 +1,10 @@ +/* eslint-env node */ + +module.exports = { + plugins: [ + require('postcss-import-ext-glob'), + require('postcss-import'), + require('tailwindcss/nesting'), + require('tailwindcss'), + ], +}; diff --git a/tailwind/.eslintrc b/tailwind/.eslintrc new file mode 100644 index 0000000..5e14571 --- /dev/null +++ b/tailwind/.eslintrc @@ -0,0 +1,5 @@ +{ + "env": { + "node": true + } +} diff --git a/tailwind/custom/base.css b/tailwind/custom/base.css new file mode 100644 index 0000000..2253e84 --- /dev/null +++ b/tailwind/custom/base.css @@ -0,0 +1,16 @@ +/** + * Custom styles to immediately follow Tailwind’s `base` layer + * + * “Add things like base typography styles [or] opinionated global resets.” + * + * — from https://tailwindcss.com/docs/plugins#adding-base-styles + */ + +/** + * This uses the background and foreground colors declared in the + * `theme.json` file and is applied both to the frontend and in the block + * editor. +*/ +body { + @apply bg-background text-foreground font-sans; +} diff --git a/tailwind/custom/components/components.css b/tailwind/custom/components/components.css new file mode 100644 index 0000000..05ca0f1 --- /dev/null +++ b/tailwind/custom/components/components.css @@ -0,0 +1,56 @@ +/** + * Custom styles to immediately follow Tailwind’s `components` layer + * + * “Add more opinionated, complex classes like buttons, form controls, alerts, + * etc; the sort of pre-built components you often see in other frameworks that + * you might need to override with utility classes.” + * + * — from https://tailwindcss.com/docs/plugins#adding-components + */ + +/** + * Post title styles + * + * These will be applied to all headings with a `page-title` or `entry-title` + * class on the frontend and to the post title in the block editor. + * + * The supplied styles are meant to match the default `h1` classes from + * Tailwind Typography. + */ +.page-title, +.entry-title { + @apply max-w-content mx-auto mb-6 text-3xl font-extrabold text-neutral-900; +} + +/** + * Layout styles for centered content areas + * + * If you are controlling the width of your content area with styles applied + * to its container, you can delete the following styles whose selectors begin + * with `.page-content >` and `.entry-content >`. For more details, please see + * the following: + * + * https://make.wordpress.org/core/2021/06/29/on-layout-and-content-width-in-wordpress-5-8/ + */ +.page-content > *, +.entry-content > * { + /* Content width from the `theme.json` file */ + @apply max-w-content mx-auto; +} + +.entry-content > .alignwide { + /* Wide width from the `theme.json` file */ + @apply max-w-wide; +} + +.entry-content > .alignfull { + @apply max-w-none; +} + +.entry-content > .alignleft { + @apply float-left mr-8; +} + +.entry-content > .alignright { + @apply float-right ml-8; +} diff --git a/tailwind/custom/file-header.css b/tailwind/custom/file-header.css new file mode 100644 index 0000000..9bbead4 --- /dev/null +++ b/tailwind/custom/file-header.css @@ -0,0 +1,23 @@ +/*! +Theme Name: Valier +Theme URI: https://josevi.dev +Author: Josevi Canet +Author URI: https://josevi.dev +Description: Cumtom theme +Version: 0.1.0 +Tested up to: 6.2 +Requires PHP: 7.4 +License: GNU General Public License v2 or later +License URI: LICENSE +Text Domain: vlr +Tags: + +This theme, like WordPress, is licensed under the GPL. +Use it to make something cool, have fun, and share what you've learned. + +Valier is based on _tw https://underscoretw.com/, (C) 2021-2023 Greg Sullivan +_tw is distributed under the terms of the GNU GPL v2 or later. + +_tw is based on Underscores https://underscores.me/ and Varia https://github.com/Automattic/themes/tree/master/varia, (C) 2012-2023 Automattic, Inc. +Underscores and Varia are distributed under the terms of the GNU GPL v2 or later. +*/ diff --git a/tailwind/custom/fonts.css b/tailwind/custom/fonts.css new file mode 100644 index 0000000..c511b84 --- /dev/null +++ b/tailwind/custom/fonts.css @@ -0,0 +1,5 @@ +/** + * Custom `@font-face` rules + * + * These will be added immediately before Tailwind’s `base` layer. + */ diff --git a/tailwind/custom/utilities.css b/tailwind/custom/utilities.css new file mode 100644 index 0000000..73b1cc7 --- /dev/null +++ b/tailwind/custom/utilities.css @@ -0,0 +1,8 @@ +/** + * Custom styles to immediately follow Tailwind’s `utilities` layer + * + * Add your own utility classes to this theme. Complex utility classes should + * be added using Tailwind’s plugin system: + * + * https://tailwindcss.com/docs/plugins#adding-utilities + */ diff --git a/tailwind/tailwind-editor-extra.css b/tailwind/tailwind-editor-extra.css new file mode 100644 index 0000000..a9dd226 --- /dev/null +++ b/tailwind/tailwind-editor-extra.css @@ -0,0 +1,17 @@ +/** + * Additional styles applied only to the WordPress editor + * + * It is sometimes necessary to add additional styles for the WordPress block + * editor, generally to improve the editor experience. For example, you may + * want to tweak the appearance of the title area to better match your site’s + * front end, or you may need to change the appearance of a block to better + * distinguish between its fields while editing. + * + * Those styles should be added in this file, and they will be added only to + * the block editor. + */ + +.entry-header, +.entry-content { + @apply px-8; +} diff --git a/tailwind/tailwind-typography.config.js b/tailwind/tailwind-typography.config.js new file mode 100644 index 0000000..5a02b6b --- /dev/null +++ b/tailwind/tailwind-typography.config.js @@ -0,0 +1,160 @@ +// Copied from Tailwind Typography. +const hexToRgb = (hex) => { + if (typeof hex !== 'string' || hex.length === 0) { + return hex; + } + + hex = hex.replace('#', ''); + hex = hex.length === 3 ? hex.replace(/./g, '$&$&') : hex; + const r = parseInt(hex.substring(0, 2), 16); + const g = parseInt(hex.substring(2, 4), 16); + const b = parseInt(hex.substring(4, 6), 16); + return `${r} ${g} ${b}`; +}; + +module.exports = { + theme: { + extend: { + typography: (theme) => ({ + /** + * Tailwind Typography’s default styles are opinionated, and + * you may need to override them if you have mockups to + * replicate. You can view the default modifiers here: + * + * https://github.com/tailwindlabs/tailwindcss-typography/blob/master/src/styles.js + */ + + DEFAULT: { + css: [ + { + /** + * By default, max-width is set to 65 characters. + * This is a good default for readability, but + * often in conflict with client-supplied designs. + * A value of false removes the max-width property. + */ + maxWidth: false, + + /** + * Tailwind Typography uses the font weights 400 + * through 900. If you’re not using a variable font, + * you may need to limit the number of supported + * weights. Below are all of the default weights, + * ready to be overridden. + */ + // a: { + // fontWeight: '500', + // }, + // strong: { + // fontWeight: '600', + // }, + // 'ol > li::marker': { + // fontWeight: '400', + // }, + // dt: { + // fontWeight: '600', + // }, + // blockquote: { + // fontWeight: '500', + // }, + // h1: { + // fontWeight: '800', + // }, + // 'h1 strong': { + // fontWeight: '900', + // }, + // h2: { + // fontWeight: '700', + // }, + // 'h2 strong': { + // fontWeight: '800', + // }, + // h3: { + // fontWeight: '600', + // }, + // 'h3 strong': { + // fontWeight: '700', + // }, + // h4: { + // fontWeight: '600', + // }, + // 'h4 strong': { + // fontWeight: '700', + // }, + // kbd: { + // fontWeight: '500', + // }, + // code: { + // fontWeight: '600', + // }, + // pre: { + // fontWeight: '400', + // }, + // 'thead th': { + // fontWeight: '600', + // }, + }, + ], + }, + + /** + * By default, _tw uses Tailwind Typography’s Neutral gray + * scale. If you are adapting an existing design and you need + * to set specific colors throughout, you can do so here. In + * your `./theme/functions.php file, you will need to replace + * `prose-neutral` with `prose-valier`. + */ + valier: { + css: { + '--tw-prose-body': theme('colors.foreground'), + '--tw-prose-headings': theme('colors.foreground'), + '--tw-prose-lead': theme('colors.foreground'), + '--tw-prose-links': theme('colors.primary'), + '--tw-prose-bold': theme('colors.foreground'), + '--tw-prose-counters': theme('colors.primary'), + '--tw-prose-bullets': theme('colors.primary'), + '--tw-prose-hr': theme('colors.foreground'), + '--tw-prose-quotes': theme('colors.foreground'), + '--tw-prose-quote-borders': theme('colors.primary'), + '--tw-prose-captions': theme('colors.foreground'), + '--tw-prose-kbd': theme('colors.foreground'), + '--tw-prose-kbd-shadows': hexToRgb( + theme('colors.foreground') + ), + '--tw-prose-code': theme('colors.foreground'), + '--tw-prose-pre-code': theme('colors.background'), + '--tw-prose-pre-bg': theme('colors.foreground'), + '--tw-prose-th-borders': theme('colors.foreground'), + '--tw-prose-td-borders': theme('colors.foreground'), + '--tw-prose-invert-body': theme('colors.background'), + '--tw-prose-invert-headings': + theme('colors.background'), + '--tw-prose-invert-lead': theme('colors.background'), + '--tw-prose-invert-links': theme('colors.primary'), + '--tw-prose-invert-bold': theme('colors.background'), + '--tw-prose-invert-counters': theme('colors.primary'), + '--tw-prose-invert-bullets': theme('colors.primary'), + '--tw-prose-invert-hr': theme('colors.background'), + '--tw-prose-invert-quotes': theme('colors.background'), + '--tw-prose-invert-quote-borders': + theme('colors.primary'), + '--tw-prose-invert-captions': + theme('colors.background'), + '--tw-prose-invert-kbd': theme('colors.background'), + '--tw-prose-invert-kbd-shadows': hexToRgb( + theme('colors.background') + ), + '--tw-prose-invert-code': theme('colors.foreground'), + '--tw-prose-invert-pre-code': + theme('colors.background'), + '--tw-prose-invert-pre-bg': 'rgb(0 0 0 / 50%)', + '--tw-prose-invert-th-borders': + theme('colors.background'), + '--tw-prose-invert-td-borders': + theme('colors.background'), + }, + }, + }), + }, + }, +}; diff --git a/tailwind/tailwind.config.js b/tailwind/tailwind.config.js new file mode 100644 index 0000000..22ae717 --- /dev/null +++ b/tailwind/tailwind.config.js @@ -0,0 +1,33 @@ +// Set the Preflight flag based on the build target. +const includePreflight = 'editor' === process.env._TW_TARGET ? false : true; + +module.exports = { + presets: [ + // Manage Tailwind Typography's configuration in a separate file. + require('./tailwind-typography.config.js'), + ], + content: [ + // Ensure changes to PHP files and `theme.json` trigger a rebuild. + './theme/**/*.php', + ], + theme: { + // Extend the default Tailwind theme. + extend: {}, + }, + corePlugins: { + // Disable Preflight base styles in builds targeting the editor. + preflight: includePreflight, + }, + plugins: [ + // Add Tailwind Typography (via _tw fork). + require('@_tw/typography'), + + // Extract colors and widths from `theme.json`. + require('@_tw/themejson'), + + // Uncomment below to add additional first-party Tailwind plugins. + // require('@tailwindcss/forms'), + // require('@tailwindcss/aspect-ratio'), + // require('@tailwindcss/container-queries'), + ], +}; diff --git a/tailwind/tailwind.css b/tailwind/tailwind.css new file mode 100644 index 0000000..c4b6ff5 --- /dev/null +++ b/tailwind/tailwind.css @@ -0,0 +1,37 @@ +@import "./custom/file-header.css"; +/** + * The line above injects the WordPress file header. It needs to be first, + * before this comment. + */ + +/** + * This injects custom `@font-face` rules. + */ +@import "./custom/fonts.css"; + +/** + * This injects Tailwind's base styles and any base styles registered by + * plugins, then adds custom base styles. + */ +@import "tailwindcss/base"; +@import "./custom/base.css"; + +/** + * This injects Tailwind's component classes and any component classes + * registered by plugins, then adds custom component classes. + * + * The `@import-glob` line imports all CSS files from the `components` + * directory (except for `components.css`, which is imported on the following + * line). This is meant to simplify the process of integrating styles from + * JavaScript components or WordPress plugins. + */ +@import "tailwindcss/components"; +@import-glob "./custom/components/**/!(components).css"; +@import "./custom/components/components.css"; + +/** + * This injects Tailwind's utility classes and any utility classes registered + * by plugins, then adds custom utility classes. + */ +@import "tailwindcss/utilities"; +@import "./custom/utilities.css"; diff --git a/theme/404.php b/theme/404.php new file mode 100644 index 0000000..dd8c5cc --- /dev/null +++ b/theme/404.php @@ -0,0 +1,31 @@ + + +
+
+ +
+ + +
> +

+ +
+
+ +
+
+ + + +
+
+ + + + + + +
+
+ + + +
+ + +

+ +

+ + + +
    + 'ol', + 'callback' => 'vlr_html5_comment', + 'short_ping' => true, + ) + ); + ?> +
+ + +

+ + +
diff --git a/theme/footer.php b/theme/footer.php new file mode 100644 index 0000000..b6d4ca3 --- /dev/null +++ b/theme/footer.php @@ -0,0 +1,23 @@ + + + + + + + + + + + + diff --git a/theme/functions.php b/theme/functions.php new file mode 100644 index 0000000..9157b63 --- /dev/null +++ b/theme/functions.php @@ -0,0 +1,197 @@ + tag in the document head, and expect WordPress to + * provide it for us. + */ + add_theme_support( 'title-tag' ); + + /* + * Enable support for Post Thumbnails on posts and pages. + * + * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/ + */ + add_theme_support( 'post-thumbnails' ); + + // This theme uses wp_nav_menu() in two locations. + register_nav_menus( + array( + 'menu-1' => __( 'Primary', 'valier' ), + 'menu-2' => __( 'Footer Menu', 'valier' ), + ) + ); + + /* + * Switch default core markup for search form, comment form, and comments + * to output valid HTML5. + */ + add_theme_support( + 'html5', + array( + 'search-form', + 'comment-form', + 'comment-list', + 'gallery', + 'caption', + 'style', + 'script', + ) + ); + + // Add theme support for selective refresh for widgets. + add_theme_support( 'customize-selective-refresh-widgets' ); + + // Add support for editor styles. + add_theme_support( 'editor-styles' ); + + // Enqueue editor styles. + add_editor_style( 'style-editor.css' ); + add_editor_style( 'style-editor-extra.css' ); + + // Add support for responsive embedded content. + add_theme_support( 'responsive-embeds' ); + + // Remove support for block templates. + remove_theme_support( 'block-templates' ); + } +endif; +add_action( 'after_setup_theme', 'vlr_setup' ); + +/** + * Register widget area. + * + * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar + */ +function vlr_widgets_init() { + register_sidebar( + array( + 'name' => __( 'Footer', 'valier' ), + 'id' => 'sidebar-1', + 'description' => __( 'Add widgets here to appear in your footer.', 'valier' ), + 'before_widget' => '
', + 'after_widget' => '
', + 'before_title' => '

', + 'after_title' => '

', + ) + ); +} +add_action( 'widgets_init', 'vlr_widgets_init' ); + +/** + * Enqueue scripts and styles. + */ +function vlr_scripts() { + wp_enqueue_style( 'valier-style', get_stylesheet_uri(), array(), VLR_VERSION ); + wp_enqueue_script( 'valier-script', get_template_directory_uri() . '/js/script.min.js', array(), VLR_VERSION, true ); + + if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { + wp_enqueue_script( 'comment-reply' ); + } +} +add_action( 'wp_enqueue_scripts', 'vlr_scripts' ); + +/** + * Enqueue the block editor script. + */ +function vlr_enqueue_block_editor_script() { + if ( is_admin() ) { + wp_enqueue_script( + 'valier-editor', + get_template_directory_uri() . '/js/block-editor.min.js', + array( + 'wp-blocks', + 'wp-edit-post', + ), + VLR_VERSION, + true + ); + wp_add_inline_script( 'valier-editor', "tailwindTypographyClasses = '" . esc_attr( VLR_TYPOGRAPHY_CLASSES ) . "'.split(' ');", 'before' ); + } +} +add_action( 'enqueue_block_assets', 'vlr_enqueue_block_editor_script' ); + +/** + * Add the Tailwind Typography classes to TinyMCE. + * + * @param array $settings TinyMCE settings. + * @return array + */ +function vlr_tinymce_add_class( $settings ) { + $settings['body_class'] = VLR_TYPOGRAPHY_CLASSES; + return $settings; +} +add_filter( 'tiny_mce_before_init', 'vlr_tinymce_add_class' ); + +/** + * Custom template tags for this theme. + */ +require get_template_directory() . '/inc/template-tags.php'; + +/** + * Functions which enhance the theme by hooking into WordPress. + */ +require get_template_directory() . '/inc/template-functions.php'; diff --git a/theme/header.php b/theme/header.php new file mode 100644 index 0000000..be458ba --- /dev/null +++ b/theme/header.php @@ -0,0 +1,31 @@ + +> + + + + + + + +> + + + +
+ + + + +
diff --git a/theme/inc/template-functions.php b/theme/inc/template-functions.php new file mode 100644 index 0000000..cd73ad8 --- /dev/null +++ b/theme/inc/template-functions.php @@ -0,0 +1,206 @@ +', esc_url( get_bloginfo( 'pingback_url' ) ) ); + } +} +add_action( 'wp_head', 'vlr_pingback_header' ); + +/** + * Changes comment form default fields. + * + * @param array $defaults The default comment form arguments. + * + * @return array Returns the modified fields. + */ +function vlr_comment_form_defaults( $defaults ) { + $comment_field = $defaults['comment_field']; + + // Adjust height of comment form. + $defaults['comment_field'] = preg_replace( '/rows="\d+"/', 'rows="5"', $comment_field ); + + return $defaults; +} +add_filter( 'comment_form_defaults', 'vlr_comment_form_defaults' ); + +/** + * Filters the default archive titles. + */ +function vlr_get_the_archive_title() { + if ( is_category() ) { + $title = __( 'Category Archives: ', 'valier' ) . '' . single_term_title( '', false ) . ''; + } elseif ( is_tag() ) { + $title = __( 'Tag Archives: ', 'valier' ) . '' . single_term_title( '', false ) . ''; + } elseif ( is_author() ) { + $title = __( 'Author Archives: ', 'valier' ) . '' . get_the_author_meta( 'display_name' ) . ''; + } elseif ( is_year() ) { + $title = __( 'Yearly Archives: ', 'valier' ) . '' . get_the_date( _x( 'Y', 'yearly archives date format', 'valier' ) ) . ''; + } elseif ( is_month() ) { + $title = __( 'Monthly Archives: ', 'valier' ) . '' . get_the_date( _x( 'F Y', 'monthly archives date format', 'valier' ) ) . ''; + } elseif ( is_day() ) { + $title = __( 'Daily Archives: ', 'valier' ) . '' . get_the_date() . ''; + } elseif ( is_post_type_archive() ) { + $cpt = get_post_type_object( get_queried_object()->name ); + $title = sprintf( + /* translators: %s: Post type singular name */ + esc_html__( '%s Archives', 'valier' ), + $cpt->labels->singular_name + ); + } elseif ( is_tax() ) { + $tax = get_taxonomy( get_queried_object()->taxonomy ); + $title = sprintf( + /* translators: %s: Taxonomy singular name */ + esc_html__( '%s Archives', 'valier' ), + $tax->labels->singular_name + ); + } else { + $title = __( 'Archives:', 'valier' ); + } + return $title; +} +add_filter( 'get_the_archive_title', 'vlr_get_the_archive_title' ); + +/** + * Determines whether the post thumbnail can be displayed. + */ +function vlr_can_show_post_thumbnail() { + return apply_filters( 'vlr_can_show_post_thumbnail', ! post_password_required() && ! is_attachment() && has_post_thumbnail() ); +} + +/** + * Returns the size for avatars used in the theme. + */ +function vlr_get_avatar_size() { + return 60; +} + +/** + * Create the continue reading link + * + * @param string $more_string The string shown within the more link. + */ +function vlr_continue_reading_link( $more_string ) { + + if ( ! is_admin() ) { + $continue_reading = sprintf( + /* translators: %s: Name of current post. */ + wp_kses( __( 'Continue reading %s', 'valier' ), array( 'span' => array( 'class' => array() ) ) ), + the_title( '"', '"', false ) + ); + + $more_string = '' . $continue_reading . ''; + } + + return $more_string; +} + +// Filter the excerpt more link. +add_filter( 'excerpt_more', 'vlr_continue_reading_link' ); + +// Filter the content more link. +add_filter( 'the_content_more_link', 'vlr_continue_reading_link' ); + +/** + * Outputs a comment in the HTML5 format. + * + * This function overrides the default WordPress comment output in HTML5 + * format, adding the required class for Tailwind Typography. Based on the + * `html5_comment()` function from WordPress core. + * + * @param WP_Comment $comment Comment to display. + * @param array $args An array of arguments. + * @param int $depth Depth of the current comment. + */ +function vlr_html5_comment( $comment, $args, $depth ) { + $tag = ( 'div' === $args['style'] ) ? 'div' : 'li'; + + $commenter = wp_get_current_commenter(); + $show_pending_links = ! empty( $commenter['comment_author'] ); + + if ( $commenter['comment_author_email'] ) { + $moderation_note = __( 'Your comment is awaiting moderation.', 'valier' ); + } else { + $moderation_note = __( 'Your comment is awaiting moderation. This is a preview; your comment will be visible after it has been approved.', 'valier' ); + } + ?> + < id="comment-" has_children ? 'parent' : '', $comment ); ?>> +
+
+
+ + comment_approved && ! $show_pending_links ) { + $comment_author = get_comment_author( $comment ); + } + + printf( + /* translators: %s: Comment author link. */ + wp_kses_post( __( '%s says:', 'valier' ) ), + sprintf( '%s', wp_kses_post( $comment_author ) ) + ); + ?> +
+ + + + comment_approved ) : ?> + + +
+ +
> + +
+ + comment_approved || $show_pending_links ) { + comment_reply_link( + array_merge( + $args, + array( + 'add_below' => 'div-comment', + 'depth' => $depth, + 'max_depth' => $args['max_depth'], + 'before' => '
', + 'after' => '
', + ) + ) + ); + } + ?> +
+ %2$s'; + if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) { + $time_string = ''; + } + + $time_string = sprintf( + $time_string, + esc_attr( get_the_date( DATE_W3C ) ), + esc_html( get_the_date() ), + esc_attr( get_the_modified_date( DATE_W3C ) ), + esc_html( get_the_modified_date() ) + ); + + printf( + '%2$s', + esc_url( get_permalink() ), + $time_string // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped + ); + } +endif; + +if ( ! function_exists( 'vlr_posted_by' ) ) : + /** + * Prints HTML with meta information about theme author. + */ + function vlr_posted_by() { + printf( + /* translators: 1: posted by label, only visible to screen readers. 2: author link. 3: post author. */ + '%1$s%3$s', + esc_html__( 'Posted by', 'valier' ), + esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), + esc_html( get_the_author() ) + ); + } +endif; + +if ( ! function_exists( 'vlr_comment_count' ) ) : + /** + * Prints HTML with the comment count for the current post. + */ + function vlr_comment_count() { + if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) { + /* translators: %s: Name of current post. Only visible to screen readers. */ + comments_popup_link( sprintf( __( 'Leave a comment on %s', 'valier' ), get_the_title() ) ); + } + } +endif; + +if ( ! function_exists( 'vlr_entry_meta' ) ) : + /** + * Prints HTML with meta information for the categories, tags and comments. + * This template tag is used in the entry header. + */ + function vlr_entry_meta() { + + // Hide author, post date, category and tag text for pages. + if ( 'post' === get_post_type() ) { + + // Posted by. + vlr_posted_by(); + + // Posted on. + vlr_posted_on(); + + /* translators: used between list items, there is a space after the comma. */ + $categories_list = get_the_category_list( __( ', ', 'valier' ) ); + if ( $categories_list ) { + printf( + /* translators: 1: posted in label, only visible to screen readers. 2: list of categories. */ + '%1$s%2$s', + esc_html__( 'Posted in', 'valier' ), + $categories_list // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped + ); + } + + /* translators: used between list items, there is a space after the comma. */ + $tags_list = get_the_tag_list( '', __( ', ', 'valier' ) ); + if ( $tags_list ) { + printf( + /* translators: 1: tags label, only visible to screen readers. 2: list of tags. */ + '%1$s%2$s', + esc_html__( 'Tags:', 'valier' ), + $tags_list // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped + ); + } + } + + // Comment count. + if ( ! is_singular() ) { + vlr_comment_count(); + } + + // Edit post link. + edit_post_link( + sprintf( + wp_kses( + /* translators: %s: Name of current post. Only visible to screen readers. */ + __( 'Edit %s', 'valier' ), + array( + 'span' => array( + 'class' => array(), + ), + ) + ), + get_the_title() + ) + ); + } +endif; + +if ( ! function_exists( 'vlr_entry_footer' ) ) : + /** + * Prints HTML with meta information for the categories, tags and comments. + */ + function vlr_entry_footer() { + + // Hide author, post date, category and tag text for pages. + if ( 'post' === get_post_type() ) { + + // Posted by. + vlr_posted_by(); + + // Posted on. + vlr_posted_on(); + + /* translators: used between list items, there is a space after the comma. */ + $categories_list = get_the_category_list( __( ', ', 'valier' ) ); + if ( $categories_list ) { + printf( + /* translators: 1: posted in label, only visible to screen readers. 2: list of categories. */ + '%1$s%2$s', + esc_html__( 'Posted in', 'valier' ), + $categories_list // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped + ); + } + + /* translators: used between list items, there is a space after the comma. */ + $tags_list = get_the_tag_list( '', __( ', ', 'valier' ) ); + if ( $tags_list ) { + printf( + /* translators: 1: tags label, only visible to screen readers. 2: list of tags. */ + '%1$s%2$s', + esc_html__( 'Tags:', 'valier' ), + $tags_list // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped + ); + } + } + + // Comment count. + if ( ! is_singular() ) { + vlr_comment_count(); + } + + // Edit post link. + edit_post_link( + sprintf( + wp_kses( + /* translators: %s: Name of current post. Only visible to screen readers. */ + __( 'Edit %s', 'valier' ), + array( + 'span' => array( + 'class' => array(), + ), + ) + ), + get_the_title() + ) + ); + } +endif; + +if ( ! function_exists( 'vlr_post_thumbnail' ) ) : + /** + * Displays an optional post thumbnail, wrapping the post thumbnail in an + * anchor element except when viewing a single post. + */ + function vlr_post_thumbnail() { + if ( ! vlr_can_show_post_thumbnail() ) { + return; + } + + if ( is_singular() ) : + ?> + +
+ +
+ + + +
+ +
+ + %s
', get_avatar( $id_or_email, vlr_get_avatar_size() ) ); + } +endif; + +if ( ! function_exists( 'vlr_discussion_avatars_list' ) ) : + /** + * Displays a list of avatars involved in a discussion for a given post. + * + * @param array $comment_authors Comment authors to list as avatars. + */ + function vlr_discussion_avatars_list( $comment_authors ) { + if ( empty( $comment_authors ) ) { + return; + } + echo '
    ', "\n"; + foreach ( $comment_authors as $id_or_email ) { + printf( + "
  1. %s
  2. \n", + vlr_get_user_avatar_markup( $id_or_email ) // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped + ); + } + echo '
', "\n"; + } +endif; + +if ( ! function_exists( 'vlr_the_posts_navigation' ) ) : + /** + * Wraps `the_posts_pagination` for use throughout the theme. + */ + function vlr_the_posts_navigation() { + the_posts_pagination( + array( + 'mid_size' => 2, + 'prev_text' => __( 'Newer posts', 'valier' ), + 'next_text' => __( 'Older posts', 'valier' ), + ) + ); + } +endif; + +if ( ! function_exists( 'vlr_content_class' ) ) : + /** + * Displays the class names for the post content wrapper. + * + * This allows us to add Tailwind Typography’s modifier classes throughout + * the theme without repeating them in multiple files. (They can be edited + * at the top of the `../functions.php` file via the + * VLR_TYPOGRAPHY_CLASSES constant.) + * + * Based on WordPress core’s `body_class` and `get_body_class` functions. + * + * @param string|string[] $classes Space-separated string or array of class + * names to add to the class list. + */ + function vlr_content_class( $classes = '' ) { + $all_classes = array( $classes, VLR_TYPOGRAPHY_CLASSES ); + + foreach ( $all_classes as &$class_groups ) { + if ( ! empty( $class_groups ) ) { + if ( ! is_array( $class_groups ) ) { + $class_groups = preg_split( '#\s+#', $class_groups ); + } + } else { + // Ensure that we always coerce class to being an array. + $class_groups = array(); + } + } + + $combined_classes = array_merge( $all_classes[0], $all_classes[1] ); + $combined_classes = array_map( 'esc_attr', $combined_classes ); + + // Separates class names with a single space, preparing them for the + // post content wrapper. + echo 'class="' . esc_attr( implode( ' ', $combined_classes ) ) . '"'; + } +endif; diff --git a/theme/index.php b/theme/index.php new file mode 100644 index 0000000..4b0423f --- /dev/null +++ b/theme/index.php @@ -0,0 +1,53 @@ + + +
+
+ + +
+

+
+ + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + + + + +
+
+ + + +
+
+ + ' ' . + '' . __( 'Next post:', 'valier' ) . '
' . + '%title', + 'prev_text' => ' ' . + '' . __( 'Previous post:', 'valier' ) . '
' . + '%title', + ) + ); + } + + // If comments are open, or we have at least one comment, load + // the comment template. + if ( comments_open() || get_comments_number() ) { + comments_template(); + } + + // End the loop. + endwhile; + ?> + +
+
+ + + + diff --git a/theme/template-parts/content/content-none.php b/theme/template-parts/content/content-none.php new file mode 100644 index 0000000..f0af534 --- /dev/null +++ b/theme/template-parts/content/content-none.php @@ -0,0 +1,76 @@ + + +
+ + + +
> + + +

+ +

+ +

+ + + +

+ + + +

+ +

+ + + +

+ +

+ + +
+ +
diff --git a/theme/template-parts/content/content-page.php b/theme/template-parts/content/content-page.php new file mode 100644 index 0000000..1302282 --- /dev/null +++ b/theme/template-parts/content/content-page.php @@ -0,0 +1,60 @@ + + +
> + +
+ ', '' ); + } else { + the_title( '

', '

' ); + } + ?> +
+ + + +
> + '
' . __( 'Pages:', 'valier' ), + 'after' => '
', + ) + ); + ?> +
+ + +
+ %s', 'valier' ), + array( + 'span' => array( + 'class' => array(), + ), + ) + ), + get_the_title() + ) + ); + ?> +
+ + +
diff --git a/theme/template-parts/content/content-single.php b/theme/template-parts/content/content-single.php new file mode 100644 index 0000000..f289f51 --- /dev/null +++ b/theme/template-parts/content/content-single.php @@ -0,0 +1,56 @@ + + +
> + +
+ ', '' ); ?> + + + + +
+ + + +
> + "%s"', 'valier' ), + array( + 'span' => array( + 'class' => array(), + ), + ) + ), + get_the_title() + ) + ); + + wp_link_pages( + array( + 'before' => '
' . __( 'Pages:', 'valier' ), + 'after' => '
', + ) + ); + ?> +
+ +
+ +
+ +
diff --git a/theme/template-parts/content/content.php b/theme/template-parts/content/content.php new file mode 100644 index 0000000..8d1f7ee --- /dev/null +++ b/theme/template-parts/content/content.php @@ -0,0 +1,46 @@ + + +
> + +
+ %s', esc_html_x( 'Featured', 'post', 'valier' ) ); + } + if ( is_singular() ) : + the_title( '

', '

' ); + else : + the_title( sprintf( '

', esc_url( get_permalink() ) ), '

' ); + endif; + ?> +
+ + + +
> + '
' . __( 'Pages:', 'valier' ), + 'after' => '
', + ) + ); + ?> +
+ +
+ +
+ +
diff --git a/theme/template-parts/layout/footer-content.php b/theme/template-parts/layout/footer-content.php new file mode 100644 index 0000000..a34647e --- /dev/null +++ b/theme/template-parts/layout/footer-content.php @@ -0,0 +1,52 @@ + + +
+ + + + + + + + + +
+ + , + proudly powered by %2$s.', + esc_url( __( 'https://wordpress.org/', 'valier' ) ), + 'WordPress' + ); + ?> +
+ +
diff --git a/theme/template-parts/layout/header-content.php b/theme/template-parts/layout/header-content.php new file mode 100644 index 0000000..38a7bd0 --- /dev/null +++ b/theme/template-parts/layout/header-content.php @@ -0,0 +1,47 @@ + + +
+ +
+ +

+ +

+ +

+ +
+ + + +
diff --git a/theme/theme.json b/theme/theme.json new file mode 100644 index 0000000..223f304 --- /dev/null +++ b/theme/theme.json @@ -0,0 +1,39 @@ +{ + "$schema": "https://schemas.wp.org/trunk/theme.json", + "version": 2, + "settings": { + "color": { + "palette": [ + { + "slug": "background", + "color": "#ffffff", + "name": "Background" + }, + { + "slug": "foreground", + "color": "#404040", + "name": "Foreground" + }, + { + "slug": "primary", + "color": "#b91c1c", + "name": "Primary" + }, + { + "slug": "secondary", + "color": "#15803d", + "name": "Secondary" + }, + { + "slug": "tertiary", + "color": "#0369a1", + "name": "Tertiary" + } + ] + }, + "layout": { + "contentSize": "40rem", + "wideSize": "60rem" + } + } +}