Giter VIP home page Giter VIP logo

vaasawebdev-foundation-for-wordpress's Introduction

vaasawebdev-foundation-for-wordpress

A simple WordPress theme with Foundation for Sites dependencies.

This theme was built for demo purposes to present the possibilities to use Foundation as a basis for WordPress theme development. I presented the work at VaasaWebDev meetup on 2nd of November 2017 (slides here).

To make this theme work, you need to follow the instructions below.

Prerequisites

  1. A working local WordPress installation (I was using XAMPP running on Windows 10 64-bit in the demo)
  2. Node.js installed
  3. Git installed

Installing Foundation for Sites

  • Open command prompt.
  • Create a new theme directory under WordPress installation’s /wp-content/themes
  • Change to newly created directory
  • Clone Foundation's template via command prompt using Git (this follows the guidelines for Manually setting up ZURB Template. The template comes with ready-made workflow tools utilizing e.g. webpack, Gulp, autoprefixer & BrowserSync):
git clone https://github.com/zurb/foundation-zurb-template .
  • Install needed dependencies using Node.js:
npm install
  • Note that Foundation can also be installed using Foundation’s own wizard-like CLI tool.

You can now test that everything works by starting a build process with npm start (which in this case is alias to gulp).

Modifying Foundation files

You can now download this repository to your theme directory, overwriting Foundation's corresponding files.

Summary of changes to Foundation files

Here's a summary of changes to Foundation files I've made. These changes will be taken into use when you overwrite Foundation files with this repository.

package.json

  • change project name
  • add author info
  • add hostname to configure BrowserSync for local site live reloading
  • add devDependencies: gulp-del, gulp-notify, gulp-rename
  • remove unnecessary dependencies

gulpfile.babel.js

  • remove unnecessary imports
  • import gulp-del to enable deleting compiled files before new build
  • change CSS file output name and path for WordPress to ./style.css
  • prevent including jQuery in JavaScript output file to reduce the file size and prevent duplicate usage, as WordPress usually enqueues this anyway

config.yml

  • change path for outputting built files from /dist to root of the theme folder

/src/assets/js/app.js

  • disable including the whole Foundation JS (see next bullet)

/src/assets/js/lib/foundation-explicit-pieces.js

  • selectively include necessary Foundation JS libraries for your project (default is all)

/src/assets/scss/app.scss

  • comment out unnecessary Foundation SCSS modules (default is all)
  • configure the grid templating as you see fit; floats vs. flexbox vs. “XY-grid” (not the CSS grid). I’ve mostly used flexbox-based grid for projects.
  • add WordPress stylesheet headers
  • start adding your own (S)CSS

You can now remove unnecessary Foundation module folders under /src for static pages, layouts, partials, styleguides etc.

After these changes, run npm install again to fetch the new dependencies. You should now be able to run gulp again to have the live site appearing.

This theme only contains a few basic files to make navigation menu, title, content and footer appear. Now go ahead and start the actual WordPress theme building by editing PHP files.

WordPress theme stylesheet header

This code should be on the top of the src/assets/scss/app.scss file to make the theme selectable in WordPress' admin.

/*! ----------------------------------------------------------------------------
Theme Name: VaasaWebDev Meetup Demo
Theme URI: https://vaasawebdev.fi
Author: Mikko Siikaniemi / Mikrogramma Design
Author URI: http://www.mikrogramma.fi
Description: Handcrafted WordPress theme for VaasaWebDev meetup demo.
Version: 1.0
Text Domain: mikrogramma
---------------------------------------------------------------------------- */

Note the exclamation mark after the opening /* → file minification will remove comments like this, unless suffixed with the exclamation mark. Removing this comment from style.css will render the theme inoperable.

Demo CSS

These few lines of SCSS should go to app.scss as well to make the demo look more beautiful.

header {
	color: $white;
	padding: $global-padding * 7 0;
	background-size: cover;
	background-position: top center;
	background-repeat: no-repeat;

	h1 {
		margin-bottom: 0;
	}
}

main {
	padding-top: $global-padding * 2;
}

footer {
	padding: $global-padding;
	font-size: 70%;
	text-transform: uppercase;
	opacity: .7;
	letter-spacing: .5px;
}

vaasawebdev-foundation-for-wordpress's People

Contributors

mikkosiikaniemi avatar

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.