From 5d38b14be103b38a80bb630c603a77b0239468ae Mon Sep 17 00:00:00 2001 From: arzola <oscararzola@gmail.com> Date: Wed, 9 Nov 2022 13:32:35 -0500 Subject: [PATCH 1/3] feat: custom frontend page --- assets/styles/layouts/_header.scss | 11 +++++++++-- assets/styles/layouts/_page.scss | 2 +- dist/styles/aldine.css | 12 +++++++++--- header.php | 6 ++++-- inc/customizer/namespace.php | 22 ++++++++++++++++++++++ inc/helpers/namespace.php | 18 +++++++++++++++++- 6 files changed, 62 insertions(+), 9 deletions(-) diff --git a/assets/styles/layouts/_header.scss b/assets/styles/layouts/_header.scss index 2304858..eaa5dfe 100644 --- a/assets/styles/layouts/_header.scss +++ b/assets/styles/layouts/_header.scss @@ -20,12 +20,19 @@ } } -.home #content { +.home #content{ margin-top: -540px; background: transparent; + &.custom-homepage { + margin-top: 0; + } @media #{$breakpoint-large} { margin-top: -880px; + + &.custom-homepage { + margin-top: 0; + } } } @@ -68,7 +75,7 @@ } } -.page:not(.home) .header { +.page .header { height: rem(240); @media #{$breakpoint-large} { diff --git a/assets/styles/layouts/_page.scss b/assets/styles/layouts/_page.scss index 954a7b5..740d0a4 100644 --- a/assets/styles/layouts/_page.scss +++ b/assets/styles/layouts/_page.scss @@ -22,6 +22,6 @@ body { } } -.page.home:not(.has-sections) article { +.page article { margin-top: 0; } diff --git a/dist/styles/aldine.css b/dist/styles/aldine.css index cae2b0b..711abcf 100644 --- a/dist/styles/aldine.css +++ b/dist/styles/aldine.css @@ -2155,10 +2155,16 @@ input[type=submit] { margin-top: -540px; background: transparent; } +.home #content.custom-homepage { + margin-top: 0; +} @media screen and (min-width: 60rem) { .home #content { margin-top: -880px; } + .home #content.custom-homepage { + margin-top: 0; + } } .home .entry-header { @@ -2208,11 +2214,11 @@ input[type=submit] { } } -.page:not(.home) .header { +.page .header { height: 15rem; } @media screen and (min-width: 60rem) { - .page:not(.home) .header { + .page .header { height: 55rem; } } @@ -2282,7 +2288,7 @@ body #content a.call-to-action { text-decoration: none; } -.page.home:not(.has-sections) article { +.page article { margin-top: 0; } diff --git a/header.php b/header.php index ea0041f..7d4838f 100644 --- a/header.php +++ b/header.php @@ -9,6 +9,8 @@ * @package Aldine */ +use function Aldine\Helpers\custom_homepage; + ?> <!doctype html> <html <?php language_attributes(); ?>> @@ -20,7 +22,7 @@ <?php wp_head(); ?> </head> -<body <?php body_class(); ?> data-barba="wrapper"> +<body <?php body_class(); ?>> <svg style="display: none;" xmlns="http://www.w3.org/2000/svg"> <defs> <symbol id="icon-pressbooks" fill="currentColor" viewBox="0 0 45 44"> @@ -102,4 +104,4 @@ </div> </header> <!-- .header --> - <div id="content" class="site-content clearfix"> + <div id="content" class="site-content clearfix <?php echo custom_homepage(); ?>"> diff --git a/inc/customizer/namespace.php b/inc/customizer/namespace.php index b2a7385..7877492 100644 --- a/inc/customizer/namespace.php +++ b/inc/customizer/namespace.php @@ -227,6 +227,28 @@ function customize_register( \WP_Customize_Manager $wp_customize ) { ] ); } + + $wp_customize->add_section( + 'page_on_front', [ + 'title' => __( 'Front Page Settings', 'pressbooks-aldine' ), + 'priority' => 24, + ] + ); + + $wp_customize->add_setting( + 'page_on_front', [ + 'type' => 'option', + 'capability' => 'manage_options', + ], + ); + + $wp_customize->add_control( + 'page_on_front', [ + 'label' => __( 'Network Home Page', 'pressbooks-aldine' ), + 'section' => 'page_on_front', + 'type' => 'dropdown-pages', + ] + ); } $wp_customize->add_section( diff --git a/inc/helpers/namespace.php b/inc/helpers/namespace.php index 9533865..6b74e3f 100644 --- a/inc/helpers/namespace.php +++ b/inc/helpers/namespace.php @@ -334,7 +334,7 @@ function get_default_menu( $items = '' ) { 'SignOut' => 'sign-out', ]; - $link = ( is_front_page() ) ? network_home_url( '#main' ) : network_home_url( '/' ); + $link = network_home_url( '/' ); $items = sprintf( '<li class="%3$s %3$s-%4$s"><a href="%1$s">%2$s</a></li>', $link, @@ -565,3 +565,19 @@ function get_catalog_page(): ?\WP_Post { ]); return $catalog_pages[0] ?? null; } + +/** + * This function generate a class to know if the current page is a custom frontpage. + * + * @return string + */ +function custom_homepage(): string { + $home_page = get_option( 'page_on_front' ); + if ( $home_page ) { + $template = get_page_template_slug( $home_page ); + if ( 'page-catalog.php' === $template ) { + return 'custom-homepage'; + } + } + return ''; +} From 6b9716012669dbb4f981b6adfdfde3008c97d4e2 Mon Sep 17 00:00:00 2001 From: richard015ar <richard015ar@users.noreply.github.com> Date: Thu, 10 Nov 2022 16:03:56 +0000 Subject: [PATCH 2/3] chore(l10n): update languages/pressbooks-aldine.pot --- languages/pressbooks-aldine.pot | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/languages/pressbooks-aldine.pot b/languages/pressbooks-aldine.pot index 03d243f..0c34d82 100644 --- a/languages/pressbooks-aldine.pot +++ b/languages/pressbooks-aldine.pot @@ -9,7 +9,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"POT-Creation-Date: 2022-11-08T16:31:12+00:00\n" +"POT-Creation-Date: 2022-11-10T16:03:35+00:00\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "X-Generator: WP-CLI 2.7.1\n" "X-Domain: pressbooks-aldine\n" @@ -113,16 +113,16 @@ msgstr "" msgid "You must run <code>composer install</code> from the Aldine directory." msgstr "" -#: header.php:45 +#: header.php:47 msgid "Skip to content" msgstr "" #. translators: %s name of network -#: header.php:75 +#: header.php:77 msgid "Logo for %s" msgstr "" -#: header.php:86 +#: header.php:88 msgid "Toggle Menu" msgstr "" @@ -395,28 +395,36 @@ msgstr "" msgid "Featured book" msgstr "" -#: inc/customizer/namespace.php:234 +#: inc/customizer/namespace.php:233 +msgid "Front Page Settings" +msgstr "" + +#: inc/customizer/namespace.php:247 +msgid "Network Home Page" +msgstr "" + +#: inc/customizer/namespace.php:256 msgid "Contact Form" msgstr "" -#: inc/customizer/namespace.php:245 +#: inc/customizer/namespace.php:267 msgid "Show Contact Form" msgstr "" -#: inc/customizer/namespace.php:255 +#: inc/customizer/namespace.php:277 #: partials/contact-form.php:13 msgid "Contact Us" msgstr "" -#: inc/customizer/namespace.php:260 +#: inc/customizer/namespace.php:282 msgid "Contact Form Title" msgstr "" -#: inc/customizer/namespace.php:274 +#: inc/customizer/namespace.php:296 msgid "Contact Email" msgstr "" -#: inc/customizer/namespace.php:286 +#: inc/customizer/namespace.php:308 msgid "Contact Link" msgstr "" From 3c6b38f67decda2a83833767c8c61440cc4b0242 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 12 Nov 2022 16:20:34 -0800 Subject: [PATCH 3/3] chore(deps): bump socket.io-parser from 3.3.2 to 3.3.3 (#376) Bumps [socket.io-parser](https://github.com/socketio/socket.io-parser) from 3.3.2 to 3.3.3. - [Release notes](https://github.com/socketio/socket.io-parser/releases) - [Changelog](https://github.com/socketio/socket.io-parser/blob/main/CHANGELOG.md) - [Commits](https://github.com/socketio/socket.io-parser/compare/3.3.2...3.3.3) --- updated-dependencies: - dependency-name: socket.io-parser dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/package-lock.json b/package-lock.json index ad557f8..d46dcdb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16386,9 +16386,9 @@ } }, "node_modules/socket.io-parser": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.3.2.tgz", - "integrity": "sha512-FJvDBuOALxdCI9qwRrO/Rfp9yfndRtc1jSgVgV8FDraihmSP/MLGD5PEuJrNfjALvcQ+vMDM/33AWOYP/JSjDg==", + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.3.3.tgz", + "integrity": "sha512-qOg87q1PMWWTeO01768Yh9ogn7chB9zkKtQnya41Y355S0UmpXgpcrFwAgjYJxu9BdKug5r5e9YtVSeWhKBUZg==", "dependencies": { "component-emitter": "~1.3.0", "debug": "~3.1.0", @@ -16415,13 +16415,16 @@ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" }, "node_modules/socket.io/node_modules/socket.io-parser": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.4.1.tgz", - "integrity": "sha512-11hMgzL+WCLWf1uFtHSNvliI++tcRUWdoeYuwIl+Axvwy9z2gQM+7nJyN3STj1tLj5JyIUH8/gpDGxzAlDdi0A==", + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.4.2.tgz", + "integrity": "sha512-QFZBaZDNqZXeemwejc7D39jrq2eGK/qZuVDiMPKzZK1hLlNvjGilGt4ckfQZeVX4dGmuPzCytN9ZW1nQlEWjgA==", "dependencies": { "component-emitter": "1.2.1", "debug": "~4.1.0", "isarray": "2.0.1" + }, + "engines": { + "node": ">=10.0.0" } }, "node_modules/sockjs": { @@ -32645,9 +32648,9 @@ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" }, "socket.io-parser": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.4.1.tgz", - "integrity": "sha512-11hMgzL+WCLWf1uFtHSNvliI++tcRUWdoeYuwIl+Axvwy9z2gQM+7nJyN3STj1tLj5JyIUH8/gpDGxzAlDdi0A==", + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.4.2.tgz", + "integrity": "sha512-QFZBaZDNqZXeemwejc7D39jrq2eGK/qZuVDiMPKzZK1hLlNvjGilGt4ckfQZeVX4dGmuPzCytN9ZW1nQlEWjgA==", "requires": { "component-emitter": "1.2.1", "debug": "~4.1.0", @@ -32680,9 +32683,9 @@ } }, "socket.io-parser": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.3.2.tgz", - "integrity": "sha512-FJvDBuOALxdCI9qwRrO/Rfp9yfndRtc1jSgVgV8FDraihmSP/MLGD5PEuJrNfjALvcQ+vMDM/33AWOYP/JSjDg==", + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.3.3.tgz", + "integrity": "sha512-qOg87q1PMWWTeO01768Yh9ogn7chB9zkKtQnya41Y355S0UmpXgpcrFwAgjYJxu9BdKug5r5e9YtVSeWhKBUZg==", "requires": { "component-emitter": "~1.3.0", "debug": "~3.1.0",