Skip to content

Commit

Permalink
Merge pull request #147 from studiopress/develop
Browse files Browse the repository at this point in the history
Sync master with develop
  • Loading branch information
nickcernis committed Dec 13, 2018
2 parents 1d4c064 + c7c1262 commit af575c1
Show file tree
Hide file tree
Showing 30 changed files with 5,982 additions and 535 deletions.
4 changes: 4 additions & 0 deletions .gitattributes
Expand Up @@ -28,5 +28,9 @@
.editorconfig export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.scripts/ export-ignore
.stylelintrc.json export-ignore
composer.json export-ignore
phpcs.xml.dist export-ignore
package-lock.json export-ignore
package.json export-ignore
4 changes: 3 additions & 1 deletion .gitignore
@@ -1,2 +1,4 @@
/composer.lock
/vendor/
/phpcs.xml
node_modules/
vendor/
25 changes: 25 additions & 0 deletions .scripts/makepot.js
@@ -0,0 +1,25 @@
#!/usr/bin/env node

// This script replaces the default use of `wpi18n makepot`, with custom
// POT file headers. It can be run with `npm run makepot`.

const chalk = require('chalk');
const wpi18n = require('node-wp-i18n');

console.log(chalk`{cyan Making pot file}...`);

wpi18n.makepot(
{
domainPath: 'languages',
potHeaders: {
'poedit': true,
'x-poedit-basepath': '..',
'report-msgid-bugs-to': 'StudioPress <translations@studiopress.com>',
'last-translator': 'StudioPress <translations@studiopress.com>',
'language-team': 'StudioPress <translations@studiopress.com>'
}
}
).then(
(result) => console.log(chalk`{cyan Pot file updated at {bold ${result.domainPath}/${result.potFile}}}`),
(err) => console.log(chalk`{red ${err}}`)
);
7 changes: 7 additions & 0 deletions .stylelintrc.json
@@ -0,0 +1,7 @@
{
"extends": "stylelint-config-wordpress",
"rules": {
"no-descending-specificity": null,
"no-duplicate-selectors": null
}
}
13 changes: 13 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,17 @@
# Genesis Sample Theme Changelog

## [2.7.0] - 2018-12-12
* New: Add Gutenberg opt-in feature support (wide blocks, fonts, colors, editor and block styling).
* New: Add theme support for responsive media embeds.
* Update: General styling adjustments (remove rems for font size, center button text, responsive menu adjustments, use circles for unordered sublists).
* Update: WooCommerce styling adjustments, make mobile-first.
* Fix: Use custom logo height fallback of '1' if an SVG logo is used instead of a bitmap. (SVG support still has to be enabled in WordPress, which disables it by default.)
* Fix: Prevent featured images in Featured Posts widgets appearing at 75px square.
* Fix: Prevent JavaScript error if wp object is undefined.
* Fix: Prevent title overlaying custom logo when printing.
* Tools: Add npm scripts for automation. See https://github.com/studiopress/genesis-sample#npm-scripts.
* Tools: PHPCS and Composer improvements.

## [2.6.0] - 2018-03-22
* Fix product gallery bug in WooCommerce 3.0 update.
* Improve compliance with WordPress coding standards.
Expand Down Expand Up @@ -46,6 +58,7 @@
* Set localization.
* Update XML file.

[2.7.0]: https://github.com/copyblogger/genesis-sample/compare/2.6.0...2.7.0
[2.6.0]: https://github.com/copyblogger/genesis-sample/compare/2.3.0...2.6.0
[2.3.0]: https://github.com/copyblogger/genesis-sample/compare/2.2.4...2.3.0
[2.2.4]: https://github.com/copyblogger/genesis-sample/compare/2.2.3...2.2.4
Expand Down
33 changes: 25 additions & 8 deletions README.md
@@ -1,6 +1,6 @@
# Genesis Sample Theme

Github project link: https://github.com/copyblogger/genesis-sample/
GitHub project link: https://github.com/studiopress/genesis-sample/.


## Installation Instructions
Expand All @@ -10,9 +10,13 @@ Github project link: https://github.com/copyblogger/genesis-sample/
3. Activate the Genesis Sample theme.
4. Inside your WordPress dashboard, go to Genesis > Theme Settings and configure them to your liking.

## Theme Support

Please visit https://my.studiopress.com/help/ for theme support.

## For Developers

The version of [Genesis Sample on GitHub](https://github.com/copyblogger/genesis-sample/) includes tooling to check code against WordPress standards. To use it:
The version of [Genesis Sample on GitHub](https://github.com/studiopress/genesis-sample/) includes tooling to check code against WordPress standards. To use it:

1. Install Composer globally on your development machine. [See Composer setup steps](https://getcomposer.org/doc/00-intro.md#downloading-the-composer-executable).
2. In the command line, change directory to the Genesis Sample folder.
Expand All @@ -21,13 +25,26 @@ The version of [Genesis Sample on GitHub](https://github.com/copyblogger/genesis

You'll see output highlighting issues with PHP files that do not conform to Genesis Sample coding standards.

### Packaging for distribution
### npm scripts

Scripts are also provided to help with CSS linting, CSS autoprefixing, and creation of pot language files. To use them:

1. Switch to the branch you plan to distribute.
2. Run `composer export` to zip all non-development files as `genesis-sample.zip`.
1. Install [Node.js](https://nodejs.org/), which also gives you the Node Package Manager (npm).
2. In the command line, change directory to the Genesis Sample folder.
3. Type the command `npm install` to install dependencies.

The `export` command is an alias for `git archive -o genesis-sample.zip HEAD`.
You can then type any of these commands:

## Theme Support
- `npm run autoprefixer` to add and remove vendor prefixes in `style.css`.
- `npm run makepot` to regenerate the `languages/genesis-sample.pot` file.
- `npm run lint:css` to generate a report of style violations for `style.css`.
- `npm run zip` to create a genesis-sample.zip of the current branch. Excludes files marked export-ignore in `.gitattributes`.

Please visit https://my.studiopress.com/help/ for theme support.
### Packaging for distribution

1. Follow the install instructions for npm scripts above.
2. Switch to the git branch you plan to distribute.
3. Bump version numbers manually and commit those changes.
4. Type `npm run zip` to create `genesis-sample.zip`. Files marked export-ignore in `.gitattributes` are excluded from the zip.

The `zip` command is an alias for `git archive -o genesis-sample.zip HEAD`.
54 changes: 33 additions & 21 deletions composer.json
@@ -1,23 +1,35 @@
{
"name": "copyblogger/genesis-sample",
"description": "Genesis Sample child theme for the Genesis Framework",
"require-dev": {
"squizlabs/php_codesniffer": "^3.2",
"wp-coding-standards/wpcs": "^0.14.1",
"wimg/php-compatibility": "^8.1",
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.4",
"php": "^5.6|^7"
},
"license": "GPL-2.0+",
"authors": [
{
"name": "StudioPress",
"email": "support@studiopress.com"
}
],
"require": {},
"scripts": {
"phpcs": "phpcs",
"export": "git archive -o genesis-sample.zip HEAD"
}
"name": "studiopress/genesis-sample",
"type": "wordpress-theme",
"description": "Genesis Sample child theme for the Genesis Framework",
"homepage": "https://github.com/studiopress/genesis-sample",
"license": "GPL-2.0-or-later",
"authors": [
{
"name": "StudioPress",
"email": "support@studiopress.com"
}
],
"require": {
"php": "^5.2 || ^7",
"composer/installers": "^1"
},
"require-dev": {
"php": "^5.6 || ^7",
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.4",
"phpcompatibility/phpcompatibility-wp": "^2",
"squizlabs/php_codesniffer": "^3.3.2",
"wp-coding-standards/wpcs": "^1.1"
},
"config": {
"sort-order": true
},
"scripts": {
"install-codestandards": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin::run",
"phpcs": "phpcs"
},
"support": {
"issues": "https://github.com/studiopress/genesis-sample/issues",
"source": "https://github.com/studiopress/genesis-sample"
}
}
43 changes: 28 additions & 15 deletions functions.php
Expand Up @@ -6,13 +6,18 @@
*
* @package Genesis Sample
* @author StudioPress
* @license GPL-2.0+
* @license GPL-2.0-or-later
* @link https://www.studiopress.com/
*/

// Starts the engine.
require_once get_template_directory() . '/lib/init.php';

// Defines the child theme (do not remove).
define( 'CHILD_THEME_NAME', 'Genesis Sample' );
define( 'CHILD_THEME_URL', 'https://www.studiopress.com/' );
define( 'CHILD_THEME_VERSION', '2.7.0' );

// Sets up the Theme.
require_once get_stylesheet_directory() . '/lib/theme-defaults.php';

Expand Down Expand Up @@ -46,10 +51,15 @@ function genesis_sample_localization_setup() {
// Adds the Genesis Connect WooCommerce notice.
require_once get_stylesheet_directory() . '/lib/woocommerce/woocommerce-notice.php';

// Defines the child theme (do not remove).
define( 'CHILD_THEME_NAME', 'Genesis Sample' );
define( 'CHILD_THEME_URL', 'https://www.studiopress.com/' );
define( 'CHILD_THEME_VERSION', '2.6.0' );
add_action( 'after_setup_theme', 'genesis_child_gutenberg_support' );
/**
* Adds Gutenberg opt-in features and styling.
*
* @since 2.7.0
*/
function genesis_child_gutenberg_support() { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- using same in all child themes to allow action to be unhooked.
require_once get_stylesheet_directory() . '/lib/gutenberg/init.php';
}

add_action( 'wp_enqueue_scripts', 'genesis_sample_enqueue_scripts_styles' );
/**
Expand All @@ -65,6 +75,7 @@ function genesis_sample_enqueue_scripts_styles() {
array(),
CHILD_THEME_VERSION
);

wp_enqueue_style( 'dashicons' );

$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
Expand All @@ -75,6 +86,7 @@ function genesis_sample_enqueue_scripts_styles() {
CHILD_THEME_VERSION,
true
);

wp_localize_script(
'genesis-sample-responsive-menu',
'genesis_responsive_menu',
Expand Down Expand Up @@ -115,14 +127,10 @@ function genesis_sample_responsive_menu_settings() {

}

// Sets the content width based on the theme's design and stylesheet.
if ( ! isset( $content_width ) ) {
$content_width = 702; // Pixels.
}

// Adds support for HTML5 markup structure.
add_theme_support(
'html5', array(
'html5',
array(
'caption',
'comment-form',
'comment-list',
Expand All @@ -133,11 +141,11 @@ function genesis_sample_responsive_menu_settings() {

// Adds support for accessibility.
add_theme_support(
'genesis-accessibility', array(
'genesis-accessibility',
array(
'404-page',
'drop-down-menu',
'headings',
'rems',
'search-form',
'skip-links',
)
Expand All @@ -150,7 +158,8 @@ function genesis_sample_responsive_menu_settings() {

// Adds custom logo in Customizer > Site Identity.
add_theme_support(
'custom-logo', array(
'custom-logo',
array(
'height' => 120,
'width' => 700,
'flex-height' => true,
Expand All @@ -160,12 +169,16 @@ function genesis_sample_responsive_menu_settings() {

// Renames primary and secondary navigation menus.
add_theme_support(
'genesis-menus', array(
'genesis-menus',
array(
'primary' => __( 'Header Menu', 'genesis-sample' ),
'secondary' => __( 'Footer Menu', 'genesis-sample' ),
)
);

// Adds image sizes.
add_image_size( 'sidebar-featured', 75, 75, true );

// Adds support for after entry widget.
add_theme_support( 'genesis-after-entry-widget-area' );

Expand Down
16 changes: 7 additions & 9 deletions js/genesis-sample.js
Expand Up @@ -3,7 +3,7 @@
*
* @package GenesisSample\JS
* @author StudioPress
* @license GPL-2.0+
* @license GPL-2.0-or-later
*/

var genesisSample = ( function( $ ) {
Expand All @@ -27,22 +27,20 @@ var genesisSample = ( function( $ ) {
/**
* Initialize Genesis Sample.
*
* Internal functions to execute on document load can be called here.
* Internal functions to execute on full page load.
*
* @since 2.6.0
*/
init = function() {
// Run on first load.
load = function() {
moveContentBelowFixedHeader();

// Run after window resize.
$( window ).resize(function() {
moveContentBelowFixedHeader();
});

// Run after the Customizer updates.
// 1.5s delay is to allow logo area reflow.
if (typeof wp.customize != "undefined") {
if (typeof wp != "undefined" && typeof wp.customize != "undefined") {
wp.customize.bind( 'change', function ( setting ) {
setTimeout(function() {
moveContentBelowFixedHeader();
Expand All @@ -51,11 +49,11 @@ var genesisSample = ( function( $ ) {
}
};

// Expose the init function only.
// Expose the load and ready functions.
return {
init: init
load: load
};

})( jQuery );

jQuery( window ).on( 'load', genesisSample.init );
jQuery( window ).on( 'load', genesisSample.load );
2 changes: 1 addition & 1 deletion js/responsive-menus.js
Expand Up @@ -5,7 +5,7 @@
*
* @author StudioPress
* @link https://github.com/copyblogger/responsive-menus/
* @license GPL-2.0+
* @license GPL-2.0-or-later
* @package GenesisSample
*/

Expand Down
2 changes: 1 addition & 1 deletion js/responsive-menus.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit af575c1

Please sign in to comment.