Giter Site home page Giter Site logo

creativedotdesign / tofino Goto Github PK

View Code? Open in Web Editor NEW
29.0 5.0 5.0 7.48 MB

WordPress boilerplate theme on a modern stack. NPM and Composer.

License: Other

PHP 68.42% JavaScript 0.80% CSS 2.58% TypeScript 27.70% HTML 0.51%
wordpress-starter-theme tofino

tofino's Introduction

Tofino

Tofino

A WordPress starter theme for jumpstarting custom theme development.

Developed by Daniel Hewes, Jake Gully.

Ongoing development is sponsored by Creative Dot

Heavily inspired the by awesome WordPress starter theme Sage by Roots from Ben Word and Scott Walkinshaw.

Requirements

Prerequisite How to check How to install
PHP >= 8.2.0 php -v php.net
Node.js >= 20.0.0 node -v nodejs.org
Composer >= 2.0.0 composer -V getcomposer.org

Installation

  • Download the latest tagged release.
  • Clone the git repo and run the following commands:
composer install
npm install
npm run dev

Note that the Vite Dev Server runs on port 3000. You access the website via the hostname and Vite will HMR or refresh automatically. If the Vite Dev Server is not running the website will pull it's assets from the /dist directory.

Important: You MUST set WP_ENVIRONMENT_TYPE to development or local in your wp-config.php file for the Vite Dev Server to work. Local by Flywheel does this automatically.

Features

  • TailwindCSS (v3.4)
  • Multilingual ready (WPML)
  • Responsive
  • General Options via ACF
    • Admin login screen logo
    • Custom Dashboard Widget
    • Social links
    • Sticky header menu
    • Client Data (Address, Telephone number, Email address, Company number)
    • Footer text
    • Alert Bar with top/bottom positions
    • Maintenance mode popup
    • Custom 404 page
  • Advanced Custom Fields
  • ACF JSON Folder
  • TypeScript
  • Vite build script
  • Vitest for testing Vue components
  • Cypress for Integration and E2E tests
  • Composer for PHP package management
  • Namespaced functions
  • Auto post type / slug based template routing
  • Shortcodes
  • SVG Sprite
  • Web Font Loader load Google, Typekit and custom fonts
  • VueJS v3.x with Composition API
  • Pinia State Management
  • Form support via Tofino Form Builder plugin
  • AjaxForm PHP Class
  • Fragment Cache PHP Class

Documentation

Docs are provided by README.md files in each directory.

Deployment

We use GitHub Actions. The deployment script is issued the following commands:

composer install
npm install
npm run build

The following files and directories should not be deployed on the server:

src
node_modules
.vscode
.editorconfig
.env
.eslintrc.cjs
.git
.github
.gitignore
.gitkeep
.git-ftp-ignore
.git-ftp-include
.gitattributes
.gitignore
.prettierignore
.npmrc
composer.json
composer.lock
package.json
package-lock.json
postcss.config.cts
tsconfig.json
vite.config.ts
phpcs.xml
\*.md
cypress
cypress.config.ts
prettier.config.cjs
stylelint.config.ts
tailwind.config.ts
vite.config.ts
vite-env.d.ts

tofino's People

Contributors

brandonh676 avatar danielbachhuber avatar danimalweb avatar iwriteplays avatar jonxmack avatar malcolm-remple avatar mrchimp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

tofino's Issues

Nav item not being marked as active

From Andrew. The active class doesn't get applied to menu items if you are viewing a blog sub-page or an ACF archive.

This may just be a Sage thing but it's something we should test. I'm not sure if the blog sub-page part of it is only needed if ACF is active. We might need to make a theme setting for this, or maybe detect if ACF is active.

Here is the fix so far.

// If your blog isn't at '/blog', you'll need to change that part of the code.
// Mark (highlight) custom post type parent as active item in Wordpress Navigation
add_action('nav_menu_css_class', 'add_current_nav_class', 10, 2 );
function add_current_nav_class($classes, $item) {
  // Getting the current post details
  global $post;

  // Get post ID, if nothing found set to NULL
  $id = ( isset( $post->ID ) ? get_the_ID() : NULL );

  // Checking if post ID exist...
  if (isset( $id )){
    // Getting the post type of the current post
    $current_post_type = get_post_type_object(get_post_type($post->ID));
    $current_post_type_slug = $current_post_type->rewrite['slug'];           

    // Getting the URL of the menu item
    $menu_slug = strtolower(trim($item->url));

    // If the menu item URL contains the current post types slug add the current-menu-item class
    if (strpos($menu_slug,$current_post_type_slug) !== false) {
      array_push($classes, 'active');
    } elseif(strpos($menu_slug,'/blog')){
      // Extra fix for blog subpages, and grouped results      
      if(is_single() || is_tag() || is_month() || is_category()){
        array_push($classes, 'active');
      }
    }
  }
  // Return the corrected set of classes to be added to the menu item
  return $classes;
}

Set private:true in package.json

When you run npm install it gives a warning "no repository field". If we set private to true it will stop us from running npm publish (which we won't want to anyway) and will prevent the warning.

Use plumber to handler errors

Error handling is still hit and miss with different modules erroring in different ways.

Plumber seems to be the standard way to handle this.

Copyright text

A request from the team. Only a small one. A copyright function that would generate a copyright string from the current year and the site name.

I think this issue is longer than the code will need to be...

Webmaster role

Editor role, extended with access to certain other things.

Menu centre needs fixing

Considering making it flexbox.
Shouldn't interfere with the branding on the left or anything on the right (e.g. language selector).

Blank after install

front-page.php / home.php needs to be manually created with header and footer after install. This may be a feature and not a bug. Jake seems unsure.

Fonts

assets/fonts/* should be copied to dist/fonts/* as well as any fonts from Bootstrap.

We also need a fonts.scss file.

move wrapper class somewhere else

Currently the wrapper class is on the main element. It should be on a separate div that should be opened in header.php and closed in footer.php.

Contact Form

Should we add support for a basic contact form?

I'm stopped using Contact Form 7, and I'm now rolling my own using ajax and a php script.

Thoughts?

Possible Theme Settings

Logo Upload
Email Address
Telephone Number
Menu Position - Left/Centre/Right
Menu Sticky - Yes/No

Missing files should cause errors

There may be some rational to this that I'm not seeing but I think missing dependencies should stop the compilation. We should use Vinyl/Gulp4/whatever to make this happen. And/or consider outputting a list of included files for easier debugging.

Add console.log check to gulp

console.log can cause issues on IE if left in on production. We should check for this and show a warnign when gulping. Are there any other similar things we should be checking for?

Fix Error: ENOTEMPTY: directory not empty, when running the full build

The gulp clean task is acting up. Might be linked to the clean task running in parallel with the other tasks.

Daniels-MacBook-Pro:tofino daniel$ gulp
[23:23:57] Using gulpfile ~/Private/web/tofino.local/public_html/wp-content/themes/tofino/gulpfile.js
[23:23:57] Starting 'clean'...
[23:23:57] Starting 'images'...
[23:23:59] Starting 'svg-sprite'...
[23:24:00] Starting 'sass-lint'...
[23:24:00] Starting 'jshint'...
[23:24:01] Starting 'fonts'...
[23:24:01] gulp-imagemin: Minified 0 images
[23:24:01] Finished 'images' after 3.5 s
[23:24:01] Finished 'svg-sprite' after 1.93 s
[23:24:01] Starting 'svgs'...
[23:24:01] Finished 'svgs' after 9.45 ms
[23:24:01] Finished 'fonts' after 347 ms
[23:24:01] Finished 'jshint' after 911 ms
[23:24:01] Starting 'scripts'...
[23:24:02] 'clean' errored after 4.43 s
[23:24:02] Error: ENOTEMPTY: directory not empty, rmdir '/Users/daniel/Private/web/tofino.local/public_html/wp-content/themes/tofino/dist'
    at Error (native)```

Can't install as a zip file

If you download the zip file and install it into wp via the admin area you end up with a white screen of death. I'm assuming this is because the npm/bower/composer/gulp tasks need running. Is there some kind of WP hook for this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.