diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 00000000..58065a82 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,22 @@ +version: 2.1 +jobs: + standards: + docker: + - image: circleci/php:7.3.3-stretch-node-browsers + steps: + - checkout + - install-dependencies + - run: composer phpcs + - run: npm run lint:css + - run: npm run lint:js +commands: + install-dependencies: + description: "Install development dependencies." + steps: + - run: composer install + - run: npm ci +workflows: + version: 2 + check-standards: + jobs: + - standards diff --git a/.gitignore b/.gitignore index 1b3566d0..f6dbd9c7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.DS_Store /composer.lock /phpcs.xml node_modules/ diff --git a/.scripts/makezip.js b/.scripts/makezip.js index 015af8cf..38acd9e4 100644 --- a/.scripts/makezip.js +++ b/.scripts/makezip.js @@ -16,6 +16,7 @@ const recursive = require("recursive-readdir"); const prettyBytes = require("pretty-bytes"); const excludes = [ + ".circleci", ".DS_Store", ".editorconfig", ".eslintignore", @@ -37,8 +38,11 @@ const excludes = [ ]; // Creates a file to stream archive data to. -// Uses the name in package.json, such as 'child-theme.zip'. -let output = fs.createWriteStream(`${process.env.npm_package_name}.zip`); +// Uses the name in package.json, such as 'child-theme.1.1.0.zip'. +let fileName = `${process.env.npm_package_name}.${ + process.env.npm_package_theme_version +}.zip`; +let output = fs.createWriteStream(fileName); let archive = archiver("zip", { zlib: { level: 9 } // Best compression. @@ -52,9 +56,7 @@ const setupZipArchive = function() { // Report the zip name and size, and rename *.txt files back to *.md again. output.on("close", function() { let fileSize = prettyBytes(archive.pointer()); - console.log( - chalk`{cyan Created ${process.env.npm_package_name}.zip, ${fileSize}}` - ); + console.log(chalk`{cyan Created ${fileName}, ${fileSize}}`); renameTxtFilesToMarkdown(); }); diff --git a/CHANGELOG.md b/CHANGELOG.md index 56731967..5198c3d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,29 @@ # Genesis Sample Theme Changelog +## [3.1.0] - 2019-08-21 +Requires Genesis 3.1.0+ + +### Added +* Starter Pack feature to allow imported content choices. +* Customizer Logo width validation and messaging. +* Featured image display options for singular posts and pages. +* Footer widget import with one-click theme setup. + +### Changed +* Updated Screenshot to reflect one-click theme setup content. +* Set archive image size to genesis-singular-images on theme activation. +* Allow breadcrumbs and layout settings to be used on the landing page template. +* Use `genesis-custom-logo` functionality in place of `custom-logo`. +* Use PHP short array syntax. +* Update one-click theme setup content page meta to accommodate new Genesis 3.1 features. +* Add version number to zip files generated with `npm run zip`. ([GitHub version](https://github.com/studiopress/genesis-sample/) only.) +* Update the phpcs config to include a PHP short array rule and update PHP and WordPress testing versions. ([GitHub version](https://github.com/studiopress/genesis-sample/) only.) +* Update developer dependencies. ([GitHub version](https://github.com/studiopress/genesis-sample/) only.) +* Simplified `genesis_sample_secondary_menu_args` function. + +### Removed +* Block page template in favor of new Genesis per-page settings. + ## [3.0.1] - 2019-06-25 * Use current theme name instead of 'genesis-sample' when enqueueing assets. This ensures assets continue to load if the theme is renamed. diff --git a/config/appearance.php b/config/appearance.php index 570c9bbe..95ae832d 100644 --- a/config/appearance.php +++ b/config/appearance.php @@ -8,10 +8,10 @@ * @link https://www.studiopress.com/ */ -$genesis_sample_default_colors = array( +$genesis_sample_default_colors = [ 'link' => '#0073e5', 'accent' => '#0073e5', -); +]; $genesis_sample_link_color = get_theme_mod( 'genesis_sample_link_color', @@ -26,7 +26,7 @@ $genesis_sample_link_color_contrast = genesis_sample_color_contrast( $genesis_sample_link_color ); $genesis_sample_link_color_brightness = genesis_sample_color_brightness( $genesis_sample_link_color, 35 ); -return array( +return [ 'fonts-url' => 'https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,700&display=swap', 'content-width' => 1062, 'button-bg' => $genesis_sample_link_color, @@ -34,38 +34,38 @@ 'button-outline-hover' => $genesis_sample_link_color_brightness, 'link-color' => $genesis_sample_link_color, 'default-colors' => $genesis_sample_default_colors, - 'editor-color-palette' => array( - array( + 'editor-color-palette' => [ + [ 'name' => __( 'Custom color', 'genesis-sample' ), // Called “Link Color” in the Customizer options. Renamed because “Link Color” implies it can only be used for links. 'slug' => 'theme-primary', 'color' => $genesis_sample_link_color, - ), - array( + ], + [ 'name' => __( 'Accent color', 'genesis-sample' ), 'slug' => 'theme-secondary', 'color' => $genesis_sample_accent_color, - ), - ), - 'editor-font-sizes' => array( - array( + ], + ], + 'editor-font-sizes' => [ + [ 'name' => __( 'Small', 'genesis-sample' ), 'size' => 12, 'slug' => 'small', - ), - array( + ], + [ 'name' => __( 'Normal', 'genesis-sample' ), 'size' => 18, 'slug' => 'normal', - ), - array( + ], + [ 'name' => __( 'Large', 'genesis-sample' ), 'size' => 20, 'slug' => 'large', - ), - array( + ], + [ 'name' => __( 'Larger', 'genesis-sample' ), 'size' => 24, 'slug' => 'larger', - ), - ), -); + ], + ], +]; diff --git a/config/child-theme-settings.php b/config/child-theme-settings.php index 7b9ae750..a036f55b 100644 --- a/config/child-theme-settings.php +++ b/config/child-theme-settings.php @@ -10,8 +10,8 @@ * @link https://www.studiopress.com/ */ -return array( - GENESIS_SETTINGS_FIELD => array( +return [ + GENESIS_SETTINGS_FIELD => [ 'blog_cat_num' => 6, 'breadcrumb_home' => 0, 'breadcrumb_front_page' => 0, @@ -24,10 +24,10 @@ 'content_archive' => 'full', 'content_archive_limit' => 0, 'content_archive_thumbnail' => 0, - 'image_size' => '', - 'image_alignment' => 'alignleft', + 'image_size' => 'genesis-singular-images', + 'image_alignment' => 'aligncenter', 'posts_nav' => 'numeric', 'site_layout' => 'content-sidebar', - ), + ], 'posts_per_page' => 6, -); +]; diff --git a/config/import/content/homepage.php b/config/import/content/home-black-white.php similarity index 98% rename from config/import/content/homepage.php rename to config/import/content/home-black-white.php index 7d5b0c2c..9269bf38 100644 --- a/config/import/content/homepage.php +++ b/config/import/content/home-black-white.php @@ -10,6 +10,7 @@ * @link https://www.studiopress.com/ */ +// Photo by Rohit Tandon on Unsplash: https://unsplash.com/photos/9wg5jCEPBsw. $genesis_sample_homepage_header_image_url = CHILD_URL . '/config/import/images/mountain-bw.jpg'; // Photo by Haley Powers on Unsplash: https://unsplash.com/photos/rjhvXX7JBPc. @@ -26,7 +27,7 @@ -
+ diff --git a/config/import/content/home-color.php b/config/import/content/home-color.php new file mode 100644 index 00000000..3888f25b --- /dev/null +++ b/config/import/content/home-color.php @@ -0,0 +1,127 @@ + +All the resources, training, and support you need to run your dream online business!
+ + + + + + +Grow your audience and build a profitable online business.
Your course helped me to grow my email list from 500 to over 10,000 subscribers—all within 3 months!
I started using your email marketing technique and it helped me to make $5,000 more a month without any extra work!
I was skeptical but I found that your system had multiplied my revenue by 40% after just the first quarter!
Contact us today
+You can reach us on our contact page or by calling us at 1.123.456.7891
+Our team has a combined experience of over 60 years.
+We offer a 30-day return policy for all unused items. For more information, please view our terms of service.
+With an emphasis on typography, white space, and mobile-optimized design, your website will look absolutely breathtaking.
', + 'filter' => 1, + 'visual' => 1, + ], + ], + ], + 'footer-2' => [ + [ + 'type' => 'text', + 'args' => [ + 'title' => 'Content', + 'text' => 'Our team will teach you the art of writing audience-focused content that will help you achieve the success you truly deserve.
', + 'filter' => 1, + 'visual' => 1, + ], + ], + ], + 'footer-3' => [ + [ + 'type' => 'text', + 'args' => [ + 'title' => 'Strategy', + 'text' => 'We help creative entrepreneurs build their digital business by focusing on three key elements of a successful online platform.
', + 'filter' => 1, + 'visual' => 1, + ], + ], + ], + ], +]; diff --git a/config/onboarding.php b/config/onboarding.php index 020805a9..3f95b6df 100644 --- a/config/onboarding.php +++ b/config/onboarding.php @@ -10,95 +10,73 @@ * @link https://www.studiopress.com/ */ -return array( - 'dependencies' => array( - 'plugins' => array( - array( - 'name' => __( 'Atomic Blocks', 'genesis-sample' ), - 'slug' => 'atomic-blocks/atomicblocks.php', - 'public_url' => 'https://atomicblocks.com/', - ), - array( - 'name' => __( 'Simple Social Icons', 'genesis-sample' ), - 'slug' => 'simple-social-icons/simple-social-icons.php', - 'public_url' => 'https://wordpress.org/plugins/simple-social-icons/', - ), - array( - 'name' => __( 'Genesis eNews Extended (Third Party)', 'genesis-sample' ), - 'slug' => 'genesis-enews-extended/plugin.php', - 'public_url' => 'https://wordpress.org/plugins/genesis-enews-extended/', - ), - array( - 'name' => __( 'WPForms Lite (Third Party)', 'genesis-sample' ), - 'slug' => 'wpforms-lite/wpforms.php', - 'public_url' => 'https://wordpress.org/plugins/wpforms-lite/', - ), - ), - ), - 'content' => array( - 'homepage' => array( - 'post_title' => 'Homepage', - 'post_content' => require dirname( __FILE__ ) . '/import/content/homepage.php', - 'post_type' => 'page', - 'post_status' => 'publish', - 'page_template' => 'page-templates/blocks.php', - 'comment_status' => 'closed', - 'ping_status' => 'closed', - ), - 'blocks' => array( - 'post_title' => 'Block Content Examples', - 'post_content' => require dirname( __FILE__ ) . '/import/content/block-examples.php', - 'post_type' => 'page', - 'post_status' => 'publish', - 'comment_status' => 'closed', - 'ping_status' => 'closed', - 'meta_input' => array( '_genesis_layout' => 'full-width-content' ), - ), - 'about' => array( - 'post_title' => 'About Us', - 'post_content' => require dirname( __FILE__ ) . '/import/content/about.php', - 'post_type' => 'page', - 'post_status' => 'publish', - 'featured_image' => CHILD_URL . '/config/import/images/about.jpg', - 'comment_status' => 'closed', - 'ping_status' => 'closed', - 'meta_input' => array( '_genesis_layout' => 'full-width-content' ), - ), - 'contact' => array( - 'post_title' => 'Contact Us', - 'post_content' => require dirname( __FILE__ ) . '/import/content/contact.php', - 'post_type' => 'page', - 'post_status' => 'publish', - 'comment_status' => 'closed', - 'ping_status' => 'closed', - ), - 'landing' => array( - 'post_title' => 'Landing Page', - 'post_content' => require dirname( __FILE__ ) . '/import/content/landing-page.php', - 'post_type' => 'page', - 'post_status' => 'publish', - 'page_template' => 'page-templates/landing.php', - 'comment_status' => 'closed', - 'ping_status' => 'closed', - ), - ), - 'navigation_menus' => array( - 'primary' => array( - 'homepage' => array( - 'title' => 'Home', - ), - 'about' => array( - 'title' => 'About Us', - ), - 'contact' => array( - 'title' => 'Contact Us', - ), - 'blocks' => array( - 'title' => 'Block Examples', - ), - 'landing' => array( - 'title' => 'Landing Page', - ), - ), - ), -); +$genesis_sample_shared_content = genesis_get_config( 'onboarding-shared' ); + +return [ + 'starter_packs' => [ + 'black-white' => [ + 'title' => __( 'Black & White', 'genesis-sample' ), + 'description' => __( 'A pack with a homepage designed with black and white images.', 'genesis-sample' ), + 'thumbnail' => get_stylesheet_directory_uri() . '/config/import/images/thumbnails/home-black-white.jpg', + 'demo_url' => 'https://demo.studiopress.com/genesis-sample/', + 'config' => [ + 'dependencies' => [ + 'plugins' => $genesis_sample_shared_content['plugins'], + ], + 'content' => array_merge( + [ + 'homepage' => [ + 'post_title' => 'Homepage', + 'post_content' => require dirname( __FILE__ ) . '/import/content/home-black-white.php', + 'post_type' => 'page', + 'post_status' => 'publish', + 'comment_status' => 'closed', + 'ping_status' => 'closed', + 'meta_input' => [ + '_genesis_layout' => 'full-width-content', + '_genesis_hide_title' => true, + '_genesis_hide_breadcrumbs' => true, + '_genesis_hide_singular_image' => true, + ], + ], + ], + $genesis_sample_shared_content['content'] + ), + 'navigation_menus' => $genesis_sample_shared_content['navigation_menus'], + 'widgets' => $genesis_sample_shared_content['widgets'], + ], + ], + 'color' => [ + 'title' => __( 'Color', 'genesis-sample' ), + 'description' => __( 'A pack with a homepage designed with color images.', 'genesis-sample' ), + 'thumbnail' => get_stylesheet_directory_uri() . '/config/import/images/thumbnails/home-color.jpg', + 'demo_url' => 'https://demo.studiopress.com/genesis-sample/home-color/', + 'config' => [ + 'dependencies' => [ + 'plugins' => $genesis_sample_shared_content['plugins'], + ], + 'content' => array_merge( + [ + 'homepage' => [ + 'post_title' => 'Homepage', + 'post_content' => require dirname( __FILE__ ) . '/import/content/home-color.php', + 'post_type' => 'page', + 'post_status' => 'publish', + 'comment_status' => 'closed', + 'ping_status' => 'closed', + 'meta_input' => [ + '_genesis_layout' => 'full-width-content', + '_genesis_hide_title' => true, + '_genesis_hide_breadcrumbs' => true, + '_genesis_hide_singular_image' => true, + ], + ], + ], + $genesis_sample_shared_content['content'] + ), + 'navigation_menus' => $genesis_sample_shared_content['navigation_menus'], + 'widgets' => $genesis_sample_shared_content['widgets'], + ], + ], + ], +]; diff --git a/config/post-type-supports.php b/config/post-type-supports.php new file mode 100644 index 00000000..0583bf1b --- /dev/null +++ b/config/post-type-supports.php @@ -0,0 +1,20 @@ + [ + 'genesis-singular-images', + ], + 'page' => [ + 'genesis-singular-images', + ], +]; diff --git a/config/responsive-menus.php b/config/responsive-menus.php index 401b35c7..bde84a34 100644 --- a/config/responsive-menus.php +++ b/config/responsive-menus.php @@ -11,13 +11,13 @@ /** * Genesis responsive menus settings. (Requires Genesis 3.0+.) */ -return array( - 'script' => array( - 'menuClasses' => array( - 'others' => array( '.nav-primary' ), - ), - ), - 'extras' => array( +return [ + 'script' => [ + 'menuClasses' => [ + 'others' => [ '.nav-primary' ], + ], + ], + 'extras' => [ 'media_query_width' => '960px', - ), -); + ], +]; diff --git a/config/simple-social-icons-settings.php b/config/simple-social-icons-settings.php index b60991e1..8ec06d4a 100644 --- a/config/simple-social-icons-settings.php +++ b/config/simple-social-icons-settings.php @@ -8,7 +8,7 @@ * @link https://www.studiopress.com/ */ -return array( +return [ 'alignment' => 'alignleft', 'background_color' => '#f5f5f5', 'background_color_hover' => '#333333', @@ -17,4 +17,4 @@ 'icon_color' => '#333333', 'icon_color_hover' => '#ffffff', 'size' => 40, -); +]; diff --git a/config/theme-supports.php b/config/theme-supports.php index 756d98d5..b47b124b 100644 --- a/config/theme-supports.php +++ b/config/theme-supports.php @@ -10,30 +10,30 @@ * @link https://my.studiopress.com/themes/genesis-sample/ */ -return array( - 'custom-logo' => array( +return [ + 'genesis-custom-logo' => [ 'height' => 120, 'width' => 700, 'flex-height' => true, 'flex-width' => true, - ), - 'html5' => array( + ], + 'html5' => [ 'caption', 'comment-form', 'comment-list', 'gallery', 'search-form', - ), - 'genesis-accessibility' => array( + ], + 'genesis-accessibility' => [ 'drop-down-menu', 'headings', 'search-form', 'skip-links', - ), + ], 'genesis-after-entry-widget-area' => '', 'genesis-footer-widgets' => 3, - 'genesis-menus' => array( + 'genesis-menus' => [ 'primary' => __( 'Header Menu', 'genesis-sample' ), 'secondary' => __( 'Footer Menu', 'genesis-sample' ), - ), -); + ], +]; diff --git a/functions.php b/functions.php index 3071f286..5163794d 100755 --- a/functions.php +++ b/functions.php @@ -74,7 +74,7 @@ function genesis_sample_enqueue_scripts_styles() { wp_enqueue_style( genesis_get_theme_handle() . '-fonts', $appearance['fonts-url'], - array(), + [], genesis_get_theme_version() ); @@ -84,7 +84,7 @@ function genesis_sample_enqueue_scripts_styles() { wp_enqueue_style( genesis_get_theme_handle() . '-amp', get_stylesheet_directory_uri() . '/lib/amp/amp.css', - array( genesis_get_theme_handle() ), + [ genesis_get_theme_handle() ], genesis_get_theme_version() ); } @@ -109,32 +109,27 @@ function genesis_sample_theme_support() { } -add_filter( 'genesis_seo_title', 'genesis_sample_header_title', 10, 3 ); +add_action( 'after_setup_theme', 'genesis_sample_post_type_support', 9 ); /** - * Removes the link from the hidden site title if a custom logo is in use. + * Add desired post type supports. * - * Without this filter, the site title is hidden with CSS when a custom logo - * is in use, but the link it contains is still accessible by keyboard. + * See config file at `config/post-type-supports.php`. * - * @since 1.2.0 - * - * @param string $title The full title. - * @param string $inside The content inside the title element. - * @param string $wrap The wrapping element name, such as h1. - * @return string The site title with anchor removed if a custom logo is active. + * @since 3.0.0 */ -function genesis_sample_header_title( $title, $inside, $wrap ) { +function genesis_sample_post_type_support() { - if ( has_custom_logo() ) { - $inside = get_bloginfo( 'name' ); - } + $post_type_supports = genesis_get_config( 'post-type-supports' ); - return sprintf( '<%1$s class="site-title">%2$s%1$s>', $wrap, $inside ); + foreach ( $post_type_supports as $post_type => $args ) { + add_post_type_support( $post_type, $args ); + } } // Adds image sizes. add_image_size( 'sidebar-featured', 75, 75, true ); +add_image_size( 'genesis-singular-images', 702, 526, true ); // Removes header right widget area. unregister_sidebar( 'header-right' ); @@ -147,26 +142,6 @@ function genesis_sample_header_title( $title, $inside, $wrap ) { genesis_unregister_layout( 'sidebar-content-sidebar' ); genesis_unregister_layout( 'sidebar-sidebar-content' ); -add_filter( 'genesis_customizer_theme_settings_config', 'genesis_sample_remove_customizer_settings' ); -/** - * Removes output of header and front page breadcrumb settings in the Customizer. - * - * @since 2.6.0 - * - * @param array $config Original Customizer items. - * @return array Filtered Customizer items. - */ -function genesis_sample_remove_customizer_settings( $config ) { - - unset( $config['genesis']['sections']['genesis_header'] ); - unset( $config['genesis']['sections']['genesis_breadcrumbs']['controls']['breadcrumb_front_page'] ); - return $config; - -} - -// Displays custom logo. -add_action( 'genesis_site_title', 'the_custom_logo', 0 ); - // Repositions primary navigation menu. remove_action( 'genesis_after_header', 'genesis_do_nav' ); add_action( 'genesis_header', 'genesis_do_nav', 12 ); @@ -186,11 +161,10 @@ function genesis_sample_remove_customizer_settings( $config ) { */ function genesis_sample_secondary_menu_args( $args ) { - if ( 'secondary' !== $args['theme_location'] ) { - return $args; + if ( 'secondary' === $args['theme_location'] ) { + $args['depth'] = 1; } - $args['depth'] = 1; return $args; } diff --git a/languages/genesis-sample.pot b/languages/genesis-sample.pot index 79373397..9c72fbbb 100644 --- a/languages/genesis-sample.pot +++ b/languages/genesis-sample.pot @@ -2,9 +2,9 @@ # This file is distributed under the GPL-2.0-or-later.=!> msgid "" msgstr "" -"Project-Id-Version: Genesis Sample 3.0.1\n" +"Project-Id-Version: Genesis Sample 3.1.0\n" "Report-Msgid-Bugs-To: StudioPress