Code Monkey home page Code Monkey logo

starter-kit-theme's Introduction

Starter Kit Theme

GitHub GitHub release (latest by date)

WordPress starter theme with a modern development stack for launching projects faster and easily.

Requirements

How to use

Installation

  1. Create a new theme directory in wp-content/themes:
mkdir you-theme-dir && cd you-theme-dir
  1. Install Starter Kit Theme:
git clone --depth=1 [email protected]:solidbunch/starter-kit-theme.git . && rm -rf .git
  1. Setup node dependencies:
npm i
  1. Edit theme config object in gulpfile.js. Change theme name, theme prefix, main class, etc.

  2. Run replace names command:

npm run replaceNames

Build commands

  • Build minified assets for production:
npm run prod
  • Build assets with source maps for development:
npm run dev
  • Start watcher for development:
npm run watch
  • Start watcher with browser sync for development

Copy build/broswer-sync.config.js.sample to build/broswer-sync.config.js, edit it, and configure your local domain. After that run:

npm run browser-sync
Yarn commands
  • yarn - setup node dependencies;
  • yarn prod - build minified assets;
  • yarn dev- build assets with source maps (for development);
  • yarn watch- start watcher;
  • yarn browser-sync - start watcher with browser sync;

Structure

── app/                                # Main theme functionality files
   ├── Base/                           # Base theme functions
   │   ├──Hooks.php                    # Registering hooks
   │   ├──Settings.php                 # Theme settings framework initialization
   │   ├──Shortcode.php                # Shortcode object configuration
   │   └──ShortcodesManager.php        # Register and load shortcodes
   │
   ├── config/                         # Base theme configuration
   │   ├──_animations.php              # CSS animations declaration
   │   ├──_social_icons.php            # Social CSS classes settings. Font Awesome default
   │   ├──_social_profiles.php         # Register social profiles meta for website options 
   │   └──config.php                   # Bootstrap config file
   │
   ├── Handlers/                       # Theme hook handlers, main functionality
   │   ├──PostMeta/                    # Registering meta fields for post types. Each file separately. Runs by Base/Hooks
   │   ├──PostTypes/                   # Registering custom post types with Taxonomies. Runs by Base/Hooks
   │   ├──Settings/                    #
   │   │  └──ThemeSettings.php/        # Theme settings creation. Look in wp-admin Appearance/Theme Settings
   │   ├──Backend.php                  # wp-admin functions
   │   ├──Front.php                    # Basic Front handlers
   │   ├──HTTP2.php                    # HTTP2 support
   │   ├──LayoutGlobal.php             # Builds global theme layout using actions
   │   ├──LayoutSingle.php             # Builds single post / page etc. layout using actions
   │   ├──LazyLoad.php                 # Lazy load for images
   │   ├──Menu.php                     # Menu registration hooks and methods
   │   ├──OAuth.php                    # Oauth support
   │   ├──Optimization.php             # Removes unnecessary tags, performance optimization
   │   ├──Security.php                 # Provides some security options. Disable xmlrpc, etc
   │   ├──SetupTheme.php               # Setup theme handlers
   │   ├──VisualComposer.php           # Rewrite default WPBakery Page Builder functions
   │   └──VisualComposerExtends.php    # Extend default functional of WPBakery Page Builder
   │
   ├── Helper/                         # Helpers classes
   │   ├──ResponsiveImages/            # Modern responsive images with <picture> or <img>
   │   ├──Assets.php                   # Helper to work with assets processed by webpack
   │   ├──Front.php                    # Helper functions for templates and Front handler
   │   ├──Media.php                    # Functions to help to output and resize media
   │   ├──Utils.php                    # Other useful functions
   │   └──View.php                     # Connect and output templates
   │
   ├── Repository/                     # Repositories, help to receive data from DB
   │   └──*.php                        # Classes by each post type
   │
   ├── Shortcodes/                     # Shortcodes library (works with/without WPBakery Page Builder)
   │   ├── alert/                      # Alert block (icon, styling)
   │   ├── button/                     # Button element (icon, link, layout, styling)
   │   ├── contact_form/               # Form and form elements (checkbox, email, file uploader, text, datepicker and other)
   │   ├── google_map/                 # Improved Google Map
   │   ├── heading/                    # Heading h1,h2,h3,h4,h5,h6 (font styling, layout)
   │   ├── menu/                       # Custom menu with desktop and mobile devices support
   │   ├── news/                       # News block
   │   ├── posts/                      # Posts block (pagination, styling)
   │   ├── pricing_table/              # Pricing table (price settings, styling)
   │   ├── social_login/               # Login using social networks Facebook, Twitter, Google 
   │   ├── tabs/                       # Tabs shortcode 
   │   └── toggles/                    # Accordion shortcode
   │
   ├── templates/                      # HTML or other templates
   ├── Widgets/                        # Theme widgets
   ├── AbstractSingleton.php           # Abstract Class for creating Singleton Classes
   ├── App.php                         # Application Singleton. Entrypoint
   └── dev.php                         # Some developers functions for debug, logging, etc
   
── assets/                             # Theme assets
   ├── css/
   ├── fonts/
   ├── images/
   ├── js/
   └── libs/
   
── build/                              # Webpack configs
── dist/                               # The compiled assets
── template-parts/                     # Front templates

── vendor-custom/                      # Third-party development
   ├── aq_resizer/                     # Resizes WordPress images on the fly
   ├── carbon-fields/                  # Developer-oriented library for WordPress custom fields for all types of WordPress content
   ├── oauth/                          # Facebook, Google, Twitter libs for OAuth
   ├── tgm/                            # Required plugin installation
   └── wp-bootstrap-navwalker/         # Make awesome bootstrap menu
   
── 404.php
── comments.php
── footer.php
── functions.php
── gulpfile.js
── header.php
── index.php
── package.json
── page.php
── page-tpl-no-sidebar.php
── postcss.config.js
── screenshot.png
── sidebar.php
── single.php
── style.css
── webpack.config.js

Shortcodes

Overview

Shortcodes in the app/Shortcodes folder are loaded with the autoloader. That is, you can simply create a folder of a new shortcode with the necessary files and this shortcode will be automatically available.

Each shortcode has its view files, its assets directory, which contains its own, individual css, js, images, fonts, etc. (these attachments need to be connected via wp_enqueue_style and wp_enqueue_script in the shortcode.php file, they are not automatically connected). This is necessary to ensure that shortcode shortcuts are loaded only when the shortcode is active and that you can transfer the shortcodes by simply copying the shortcode folder.

Structure

The file structure can be any, you can add your files, but here are three files config.php, ajax.php and shortcode.php - loads by the autoloader.

── assets/              # All assets (styles, scripts, fonts, etc)
   ├── style.scss
   ├── scripts.js
   └── images/
── childs/              # Nested shortcodes, have the same structure    
── view/                # Shortcode templates    
── ajax.php             # Backend functions for ajax queries 
── config.php           # Shortcode config (required file)
── shortcode.php        # Shortcode controller (required file)
── vc.php               # WPBakery Page Builder support

starter-kit-theme's People

Contributors

alekamerlin avatar vsedzialo avatar vvv3 avatar yuriipavlov avatar zyv4yk 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

Watchers

 avatar  avatar  avatar  avatar  avatar

starter-kit-theme's Issues

Replace Unyson with Carbon Fields?

How about replacing Unyson with Carbon Fields? It looks Unyson guys won't release any new features and framework becomes outdated.

Carbon fields supports: Comments, Gutenberg Blocks, Nav Menus, Network, Post meta, Term meta, Theme options, user meta, widgets

https://docs.carbonfields.net/

wlog function

Can we setup wlog() function to write log to /wp-content/debug.log ?

Backend controller loads on front too

Its not a big problem, but some libs require in front too, its not good for performance
image

I think its need to add a condition in the constructor to determine the front and back

Make Critical CSS

It is necessary to create a critical CSS. It should be loaded in a header, be small.

Need to provide inline embedding critical CSS. This should include: reset styles, grid styles, common colors, header, header menu. Everything else needs to be connected to the footer. Including font styles. Fonts should be loaded asynchronously. To do this, it's need to make separate connection functions for different hooks. For example wp_enqueue_scripts and wp_footer

This Issue is important for PageSpeed

Shortcode config duplicates

Currently we have the same config in shortcode_name/config.php and shortcode_name/shortcode.php

i understand that this was done to allow shortcode work without JS Composer, but, how often we use shortcodes without JS Composer plugin?

is it possible to use vc_map_get_attributes() instead of shortcode_atts() in shortcode.php

Add template actions

We need to add theme actions for more flexibility, e.g.

<?php
do_action('before_header');
do_action('header');
do_action('after_header');
?>

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.