Browse Source

Remove landing page widgets, fix activation.

pull/43/head
Ned Zimmerman 7 years ago
parent
commit
227d37ea89
No known key found for this signature in database
GPG Key ID: FF56334A013120CA
  1. 7
      assets/styles/editor.scss
  2. 3
      composer.json
  3. 126
      composer.lock
  4. 7
      dist/mix-manifest.json
  5. 14503
      dist/scripts/aldine.js
  6. 10356
      dist/scripts/customizer.js
  7. 2453
      dist/styles/aldine.css
  8. 1
      dist/styles/editor.css
  9. 11
      docs/about.md
  10. 6
      docs/help.md
  11. 3
      functions.php
  12. 21
      inc/actions/namespace.php
  13. 41
      inc/activation/namespace.php
  14. 40
      inc/filters/namespace.php
  15. 13
      inc/helpers/namespace.php
  16. 11
      page.php
  17. 25
      partials/content-front-page.php
  18. 1
      webpack.mix.js

7
assets/styles/editor.scss

@ -0,0 +1,7 @@
@import '~aetna/assets/styles/common/_variables.scss';
@import '~aetna/assets/styles/common/_global.scss';
#tinymce.wp-editor {
@import '~aetna/assets/styles/components/_buttons.scss';
@import '~aetna/assets/styles/layouts/_block.scss';
}

3
composer.json

@ -20,8 +20,7 @@
"php": ">=7", "php": ">=7",
"composer/installers": "~1.0", "composer/installers": "~1.0",
"pressbooks/mix": "^2.1", "pressbooks/mix": "^2.1",
"soberwp/intervention": "1.2.0-p", "soberwp/intervention": "1.2.0-p"
"erusev/parsedown-extra": "^0.7.1"
}, },
"require-dev": { "require-dev": {
"humanmade/coding-standards": "^0.2.1", "humanmade/coding-standards": "^0.2.1",

126
composer.lock generated

@ -4,20 +4,20 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "98d5bc8ff0e066bda4383130af3ae190", "content-hash": "6a3f76d94f447a4cac0b1b48e01e07d0",
"packages": [ "packages": [
{ {
"name": "composer/installers", "name": "composer/installers",
"version": "v1.4.0", "version": "v1.5.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/composer/installers.git", "url": "https://github.com/composer/installers.git",
"reference": "9ce17fb70e9a38dd8acff0636a29f5cf4d575c1b" "reference": "049797d727261bf27f2690430d935067710049c2"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/composer/installers/zipball/9ce17fb70e9a38dd8acff0636a29f5cf4d575c1b", "url": "https://api.github.com/repos/composer/installers/zipball/049797d727261bf27f2690430d935067710049c2",
"reference": "9ce17fb70e9a38dd8acff0636a29f5cf4d575c1b", "reference": "049797d727261bf27f2690430d935067710049c2",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -29,7 +29,7 @@
}, },
"require-dev": { "require-dev": {
"composer/composer": "1.0.*@dev", "composer/composer": "1.0.*@dev",
"phpunit/phpunit": "4.1.*" "phpunit/phpunit": "^4.8.36"
}, },
"type": "composer-plugin", "type": "composer-plugin",
"extra": { "extra": {
@ -100,15 +100,18 @@
"lavalite", "lavalite",
"lithium", "lithium",
"magento", "magento",
"majima",
"mako", "mako",
"mediawiki", "mediawiki",
"modulework", "modulework",
"modx",
"moodle", "moodle",
"osclass", "osclass",
"phpbb", "phpbb",
"piwik", "piwik",
"ppi", "ppi",
"puppet", "puppet",
"pxcms",
"reindex", "reindex",
"roundcube", "roundcube",
"shopware", "shopware",
@ -121,96 +124,7 @@
"zend", "zend",
"zikula" "zikula"
], ],
"time": "2017-08-09T07:53:48+00:00" "time": "2017-12-29T09:13:20+00:00"
},
{
"name": "erusev/parsedown",
"version": "1.6.4",
"source": {
"type": "git",
"url": "https://github.com/erusev/parsedown.git",
"reference": "fbe3fe878f4fe69048bb8a52783a09802004f548"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/erusev/parsedown/zipball/fbe3fe878f4fe69048bb8a52783a09802004f548",
"reference": "fbe3fe878f4fe69048bb8a52783a09802004f548",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8.35"
},
"type": "library",
"autoload": {
"psr-0": {
"Parsedown": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Emanuil Rusev",
"email": "hello@erusev.com",
"homepage": "http://erusev.com"
}
],
"description": "Parser for Markdown.",
"homepage": "http://parsedown.org",
"keywords": [
"markdown",
"parser"
],
"time": "2017-11-14T20:44:03+00:00"
},
{
"name": "erusev/parsedown-extra",
"version": "0.7.1",
"source": {
"type": "git",
"url": "https://github.com/erusev/parsedown-extra.git",
"reference": "0db5cce7354e4b76f155d092ab5eb3981c21258c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/erusev/parsedown-extra/zipball/0db5cce7354e4b76f155d092ab5eb3981c21258c",
"reference": "0db5cce7354e4b76f155d092ab5eb3981c21258c",
"shasum": ""
},
"require": {
"erusev/parsedown": "~1.4"
},
"type": "library",
"autoload": {
"psr-0": {
"ParsedownExtra": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Emanuil Rusev",
"email": "hello@erusev.com",
"homepage": "http://erusev.com"
}
],
"description": "An extension of Parsedown that adds support for Markdown Extra.",
"homepage": "https://github.com/erusev/parsedown-extra",
"keywords": [
"markdown",
"markdown extra",
"parsedown",
"parser"
],
"time": "2015-11-01T10:19:22+00:00"
}, },
{ {
"name": "pressbooks/mix", "name": "pressbooks/mix",
@ -493,16 +407,16 @@
}, },
{ {
"name": "symfony/console", "name": "symfony/console",
"version": "v3.4.2", "version": "v3.4.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/console.git", "url": "https://github.com/symfony/console.git",
"reference": "9f21adfb92a9315b73ae2ed43138988ee4913d4e" "reference": "8394c8ef121949e8f858f13bc1e34f05169e4e7d"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/9f21adfb92a9315b73ae2ed43138988ee4913d4e", "url": "https://api.github.com/repos/symfony/console/zipball/8394c8ef121949e8f858f13bc1e34f05169e4e7d",
"reference": "9f21adfb92a9315b73ae2ed43138988ee4913d4e", "reference": "8394c8ef121949e8f858f13bc1e34f05169e4e7d",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -558,20 +472,20 @@
], ],
"description": "Symfony Console Component", "description": "Symfony Console Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2017-12-14T19:40:10+00:00" "time": "2018-01-03T07:37:34+00:00"
}, },
{ {
"name": "symfony/debug", "name": "symfony/debug",
"version": "v3.4.2", "version": "v3.4.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/debug.git", "url": "https://github.com/symfony/debug.git",
"reference": "543deab3ffff94402440b326fc94153bae2dfa7a" "reference": "603b95dda8b00020e4e6e60dc906e7b715b1c245"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/debug/zipball/543deab3ffff94402440b326fc94153bae2dfa7a", "url": "https://api.github.com/repos/symfony/debug/zipball/603b95dda8b00020e4e6e60dc906e7b715b1c245",
"reference": "543deab3ffff94402440b326fc94153bae2dfa7a", "reference": "603b95dda8b00020e4e6e60dc906e7b715b1c245",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -614,7 +528,7 @@
], ],
"description": "Symfony Debug Component", "description": "Symfony Debug Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2017-12-12T08:27:14+00:00" "time": "2018-01-03T17:14:19+00:00"
}, },
{ {
"name": "symfony/polyfill-mbstring", "name": "symfony/polyfill-mbstring",

7
dist/mix-manifest.json vendored

@ -1,5 +1,6 @@
{ {
"/scripts/aldine.js": "/scripts/aldine.js", "/scripts/aldine.js": "/scripts/aldine.js?id=c8641d03dfb38dc75e0d",
"/styles/aldine.css": "/styles/aldine.css", "/styles/aldine.css": "/styles/aldine.css?id=7e4afced01fd41647dfe",
"/scripts/customizer.js": "/scripts/customizer.js" "/styles/editor.css": "/styles/editor.css?id=5cb64f625819a8ea0777",
"/scripts/customizer.js": "/scripts/customizer.js?id=f1f1f4225cba4c1b35f2"
} }

14503
dist/scripts/aldine.js vendored

File diff suppressed because one or more lines are too long

10356
dist/scripts/customizer.js vendored

File diff suppressed because one or more lines are too long

2453
dist/styles/aldine.css vendored

File diff suppressed because one or more lines are too long

1
dist/styles/editor.css vendored

@ -0,0 +1 @@
:root{--font-family-sans-serif:"Karla",sans-serif;--font-family-monospace:"SFMono-Regular",Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--brand:#b01109;--brand-hover:#770600;--brand-accent:#015d75;--body-bg:#fff;--body-bg-alt:#f9fdff;--body-bg-alt2:#ececec;--body-color:#000;--button-primary-color:#fff;--button-primary-hover-color:#770600;--button-secondary-color:#b01109;--button-secondary-hover-color:#770600;--header-bg:#fff;--header-color:#000;--footer-bg:#444;--footer-color:#fff;--book-bg:#fff;--brand-orig:#b01109;--brand-hover-orig:#770600;--brand-accent-orig:#015d75;--primary:#b01109;--accent:#015d75;--primary-fg:#fff;--accent-fg:#fff;--header-text:#000;--cover-header-bg:#000}#tinymce.wp-editor .button{border:2px solid transparent;border-radius:3px;display:inline-block;font-family:Karla,sans-serif;font-weight:400;line-height:1.5;padding:.875rem 3.25rem;vertical-align:middle;text-align:center;text-decoration:none;text-transform:uppercase}#tinymce.wp-editor .button:focus,#tinymce.wp-editor .button:hover{text-decoration:none}#tinymce.wp-editor .button.focus,#tinymce.wp-editor .button:focus{outline:0;-webkit-box-shadow:0 0 0 3px rgba(176,17,9,.25);box-shadow:0 0 0 3px rgba(176,17,9,.25)}#tinymce.wp-editor .button.disabled,#tinymce.wp-editor .button:disabled{opacity:.65;-webkit-box-shadow:none;box-shadow:none}#tinymce.wp-editor .button.active,#tinymce.wp-editor .button:active{background-image:none;-webkit-box-shadow:0 0 0 3px rgba(176,17,9,.25),inset 0 3px 5px rgba(0,0,0,.125);box-shadow:0 0 0 3px rgba(176,17,9,.25),inset 0 3px 5px rgba(0,0,0,.125)}#tinymce.wp-editor .button--primary{background-color:var(--brand);border-color:var(--brand);color:var(--button-primary-color)}#tinymce.wp-editor .button--primary:hover{background-color:var(--brand-hover);border-color:var(--brand-hover);color:var(--button-primary-color)}#tinymce.wp-editor .button--secondary{background-color:transparent;border-color:var(--brand);color:var(--brand)}#tinymce.wp-editor .button--secondary:hover{border-color:var(--brand-hover);color:var(--brand-hover)}#tinymce.wp-editor .button--primary.button--header{background-color:var(--header-color);border-color:var(--header-color);color:var(--header-bg)}#tinymce.wp-editor .button--primary.button--header:hover,#tinymce.wp-editor .button--secondary.button--header{background-color:transparent;border-color:var(--header-color);color:var(--header-color)}#tinymce.wp-editor .button--secondary.button--header:hover{background-color:var(--header-color);border-color:var(--header-color);color:var(--header-bg)}#tinymce.wp-editor .button--circle--primary{-webkit-box-align:center;-ms-flex-align:center;align-items:center;background-color:var(--brand);color:var(--button-primary-color);border-radius:50%;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;height:3.75rem;width:3.75rem}#tinymce.wp-editor .button--circle--primary:hover{background-color:var(--brand-hover);border-color:var(--brand-hover);color:var(--button-primary-color);text-decoration:none}#tinymce.wp-editor .block{padding:5rem 0 4rem;text-align:center}@media screen and (min-width:768px){#tinymce.wp-editor .block{padding:7rem 1rem 6rem}}#tinymce.wp-editor .block--secondary{color:var(--accent-fg);background:var(--accent)}#tinymce.wp-editor .block__title{font-size:1.875rem;text-align:center;text-transform:uppercase}@media screen and (min-width:768px){#tinymce.wp-editor .block__title{font-size:3rem}}#tinymce.wp-editor .block__title:before{content:"";display:block;margin:0 auto 1rem;width:46px;height:5px;background:var(--brand-accent)}@media screen and (min-width:60em){#tinymce.wp-editor .block__title:before{margin-bottom:2rem;width:75px}}#tinymce.wp-editor .block__subtitle{font-size:1.5rem;margin-bottom:1rem;text-transform:uppercase}@media screen and (min-width:768px){#tinymce.wp-editor .block__subtitle{margin-bottom:1.5rem}}#tinymce.wp-editor .block-toggle__cta{position:relative;text-align:center}@media screen and (min-width:60em){#tinymce.wp-editor .block-toggle__cta{display:none}}#tinymce.wp-editor .block-toggle__cta__blurb{font-size:.875rem;margin-bottom:0;padding-bottom:2.5rem}#tinymce.wp-editor .block-toggle__cta__button{bottom:0;cursor:pointer;font-size:1.5rem;left:50%;margin:0;position:absolute;-webkit-transform:translate(-50%,50%);-o-transform:translate(-50%,50%);transform:translate(-50%,50%);z-index:10}#tinymce.wp-editor .block.block-toggle{padding-bottom:0}@media screen and (max-width:59.975em){#tinymce.wp-editor .block.block-toggle.block-toggle--visible .block-toggle__cta__blurb,#tinymce.wp-editor .block.block-toggle:not(.block-toggle--visible) .block-toggle__content{display:none}}#tinymce.wp-editor .block.block-toggle.block-meta{padding-bottom:6rem}

11
docs/about.md

@ -1,11 +0,0 @@
Pressbooks is simple book production software. You can use Pressbooks to publish textbooks, scholarly monographs, syllabi, fiction and non-fiction books, white papers, and more in multiple formats including:
* MOBI (for Kindle ebooks)
* EPUB (for all other ebookstores)
* designed PDF (for print-on-demand and digital distribution)
Pressbooks is used by educational institutions around the world as well as authors and publishers.
For more information about Pressbooks, see [here][1].
[1]: https://pressbooks.com/about

6
docs/help.md

@ -1,6 +0,0 @@
The easiest way to get started with Pressbooks is to follow our [4 Step Guide to Making a Book on Pressbooks][1]. Or, you can review our [Guide to Using Pressbooks][2].
If you require further assistance, please contact your network manager.
[1]: https://pressbooks.com/how-to-make-a-book-with-pressbooks
[2]: https://guide.pressbooks.com/

3
functions.php

@ -43,6 +43,9 @@ add_action( 'admin_bar_init', '\\Aldine\\Actions\\remove_admin_bar_callback' );
add_action( 'after_setup_theme', '\\Aldine\\Actions\\setup' ); add_action( 'after_setup_theme', '\\Aldine\\Actions\\setup' );
add_action( 'after_setup_theme', '\\Aldine\\Actions\\content_width', 0 ); add_action( 'after_setup_theme', '\\Aldine\\Actions\\content_width', 0 );
add_action( 'wp_head', '\\Aldine\\Actions\\output_custom_colors' ); add_action( 'wp_head', '\\Aldine\\Actions\\output_custom_colors' );
add_action( 'init', '\\Aldine\\Actions\\add_editor_styles' );
add_filter( 'mce_buttons', '\\Aldine\\Filters\\add_style_select' );
add_filter( 'tiny_mce_before_init', '\\Aldine\\Filters\\add_blocks' );
add_filter( 'body_class', '\\Aldine\\Filters\\body_classes' ); add_filter( 'body_class', '\\Aldine\\Filters\\body_classes' );
add_filter( 'excerpt_more', '\\Aldine\\Filters\\excerpt_more' ); add_filter( 'excerpt_more', '\\Aldine\\Filters\\excerpt_more' );
add_filter( 'wp_nav_menu_items', '\\Aldine\\Filters\\adjust_menu', 10, 2 ); add_filter( 'wp_nav_menu_items', '\\Aldine\\Filters\\adjust_menu', 10, 2 );

21
inc/actions/namespace.php

@ -97,18 +97,6 @@ function widgets_init() {
'before_title' => '<h2>', 'before_title' => '<h2>',
'after_title' => '</h2>', 'after_title' => '</h2>',
]; ];
register_sidebar( [
'name' => __( 'Front Page Content', 'pressbooks-aldine' ),
'description' => __(
'Add content for your network&rsquo;s front page here. Currently, only text widgets are supported.',
'aldine'
),
'id' => 'front-page-block',
'before_widget' => '<div class="block %1$s %2$s">',
'after_widget' => '</div>',
'before_title' => '<h2>',
'after_title' => '</h2>',
] );
register_sidebar( [ register_sidebar( [
'name' => __( 'Network Footer Block 1', 'pressbooks-aldine' ), 'name' => __( 'Network Footer Block 1', 'pressbooks-aldine' ),
'description' => __( 'description' => __(
@ -151,6 +139,15 @@ function enqueue_assets() {
); );
} }
/**
* Add editor styles.
*/
function add_editor_styles() {
$assets = new Assets( 'pressbooks-aldine', 'theme' );
$assets->setSrcDirectory( 'assets' )->setDistDirectory( 'dist' );
add_editor_style( $assets->getPath( 'styles/editor.css' ) );
}
/** /**
* Set the content width in pixels, based on the theme's design and stylesheet. * Set the content width in pixels, based on the theme's design and stylesheet.
* *

41
inc/activation/namespace.php

@ -11,17 +11,42 @@ use ParsedownExtra;
function create_default_content() { function create_default_content() {
if ( ! get_option( 'pb_aldine_activated' ) ) { if ( ! get_option( 'pb_aldine_activated' ) ) {
$extra = new ParsedownExtra(); $extra = new ParsedownExtra();
$about = $extra->text( file_get_contents( get_stylesheet_directory() . '/docs/about.md' ) ); $home = $extra->text( file_get_contents( get_stylesheet_directory() . '/docs/home.md' ) );
$help = $extra->text( file_get_contents( get_stylesheet_directory() . '/docs/help.md' ) ); $help = $extra->text( file_get_contents( get_stylesheet_directory() . '/docs/help.md' ) );
$default_pages = [ $default_pages = [
'about' => [ 'about' => [
'post_title' => __( 'About', 'pressbooks-aldine' ), 'post_title' => __( 'About', 'pressbooks-aldine' ),
'post_content' => apply_filters( 'pb_root_about_page_content', $about ), 'post_content' => apply_filters(
'pb_root_about_page_content',
sprintf(
'<p>%1$s</p><ul><li>%2$s</li><li>%3$s</li><li>%4$s</li></ul><p>%5$s</p><p>%6$s</p>',
__( 'Pressbooks is simple book production software. You can use Pressbooks to publish textbooks, scholarly monographs, syllabi, fiction and non-fiction books, white papers, and more in multiple formats including:', 'pressbooks-aldine' ),
__( 'MOBI (for Kindle ebooks)', 'pressbooks-aldine' ),
__( 'EPUB (for all other ebookstores)', 'pressbooks-aldine' ),
__( 'designed PDF (for print-on-demand and digital distribution)', 'pressbooks-aldine' ),
__( 'Pressbooks is used by educational institutions around the world as well as authors and publishers.', 'pressbooks' ),
sprintf(
__( 'For more information about Pressbooks, %s.', 'pressbooks-aldine' ),
sprintf( '<a href="https://pressbooks.com/about">%s</a>', __( 'see here', 'pressbooks-aldine' ) )
)
)
),
], ],
'help' => [ 'help' => [
'post_title' => __( 'Help', 'pressbooks-aldine' ), 'post_title' => __( 'Help', 'pressbooks-aldine' ),
'post_content' => apply_filters( 'pb_root_help_page_content', $help ), 'post_content' => apply_filters(
'pb_root_help_page_content',
sprintf(
'<p>%1$s</p><p>%2$s</p>',
sprintf(
__( 'The easiest way to get started with Pressbooks is to follow our %1$s. Or, you can review our %2$s.', 'pressbooks-aldine' ),
sprintf( '<a href="https://pressbooks.com/how-to-make-a-book-with-pressbooks">%s</a>', __( '4 Step Guide to Making a Book on Pressbooks', 'pressbooks-aldine' ) ),
sprintf( '<a href="https://guide.pressbooks.com/">%s</a>', __( 'Guide to Using Pressbooks', 'pressbooks-aldine' ) )
),
__( 'If you require further assistance, please contact your network manager.', 'pressbooks-aldine' )
)
),
], ],
'catalog' => [ 'catalog' => [
'post_title' => __( 'Catalog', 'pressbooks-aldine' ), 'post_title' => __( 'Catalog', 'pressbooks-aldine' ),
@ -29,7 +54,15 @@ function create_default_content() {
], ],
'home' => [ 'home' => [
'post_title' => __( 'Home', 'pressbooks-aldine' ), 'post_title' => __( 'Home', 'pressbooks-aldine' ),
'post_content' => '', 'post_content' => apply_filters(
'pb_root_home_page_content',
sprintf(
'<div class="block block--standard"><h2>%1$s</h2><p>%2$s</p><p><a class="button" href="/about/">%3$s</a></p></div>',
__( 'About Pressbooks', 'pressbooks-aldine' ),
__( 'Pressbooks is easy-to-use book writing software that lets you create a book in all the formats you need to publish.', 'pressbooks-aldine' ),
__( 'Learn More', 'pressbooks-aldine' )
)
),
], ],
]; ];

40
inc/filters/namespace.php

@ -43,11 +43,45 @@ function excerpt_more() {
/** /**
* Add style select dropdown to TinyMCE. * Add style select dropdown to TinyMCE.
* *
* @param array $buttons * @param array $buttons The default button array.
* @return array The modified array.
*/ */
function add_style_select( $buttons ) { function add_style_select( $buttons ) {
array_unshift( $buttons, 'styleselect' ); array_unshift( $buttons, 'styleselect' );
return $buttons; return $buttons;
}
/**
* Add custom block formats to TinyMCE.
*
* @param array $init_array The default array.
* @return array The modified array.
**/
function add_blocks( $init_array ) {
$style_formats = [
[
'title' => __( 'Standard Block', 'pressbooks-aldine' ),
'block' => 'div',
'classes' => [ 'block', 'block--standard' ],
'wrapper' => true,
],
[
'title' => __( 'Alternate Block', 'pressbooks-aldine' ),
'block' => 'div',
'classes' => [ 'block', 'block--alternate' ],
'wrapper' => true,
],
[
'title' => __( 'Link Button', 'pressbooks-aldine' ),
'selector' => 'a',
'classes' => 'button',
],
];
$init_array['style_formats'] = json_encode( $style_formats );
return $init_array;
} }
/** /**

13
inc/helpers/namespace.php

@ -7,19 +7,6 @@
namespace Aldine\Helpers; namespace Aldine\Helpers;
/**
* Get block count.
*
* @return int
*/
function get_block_count() {
global $_wp_sidebars_widgets;
if ( ! empty( $_wp_sidebars_widgets['front-page-block'] ) ) {
return count( $_wp_sidebars_widgets['front-page-block'] );
}
return 1;
}
/** /**
* Get catalog data. * Get catalog data.
* *

11
page.php

@ -19,7 +19,11 @@ get_header(); ?>
<?php if ( is_front_page() ) : <?php if ( is_front_page() ) :
get_template_part( 'partials/content', 'front-page' ); while ( have_posts() ) : the_post();
get_template_part( 'partials/content', 'front-page' );
endwhile; // End of the loop.
else : else :
@ -27,11 +31,6 @@ get_header(); ?>
get_template_part( 'partials/content', 'page' ); get_template_part( 'partials/content', 'page' );
// If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() ) :
comments_template();
endif;
endwhile; // End of the loop. endwhile; // End of the loop.
endif; endif;
?> ?>

25
partials/content-front-page.php

@ -11,10 +11,8 @@
<?php <?php
use function Aldine\Helpers\get_block_count;
use function Aldine\Helpers\get_catalog_data; use function Aldine\Helpers\get_catalog_data;
$block_count = get_block_count();
$front_page_catalog = get_option( 'pb_front_page_catalog' ); $front_page_catalog = get_option( 'pb_front_page_catalog' );
$latest_books_title = get_option( 'pb_front_page_catalog_title', __( 'Our Latest Titles', 'pressbooks-aldine' ) ); $latest_books_title = get_option( 'pb_front_page_catalog_title', __( 'Our Latest Titles', 'pressbooks-aldine' ) );
$page = ( get_query_var( 'page' ) ) ? get_query_var( 'page' ) : 1; $page = ( get_query_var( 'page' ) ) ? get_query_var( 'page' ) : 1;
@ -24,18 +22,15 @@ $next_page = $page + 1;
?> ?>
<div class="blocks blocks-<?php echo $block_count; ?> w-100"> <div class="blarg">
<?php if ( is_active_sidebar( 'front-page-block' ) ) : <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
dynamic_sidebar( 'front-page-block' ); <div class="entry-content">
else : ?> <?php
<div class="block"> the_content();
<div class="inside tc"> ?>
<h3 class="tc ttu"><?php _e( 'About Pressbooks', 'pressbooks-aldine' ) ?></h3> </div><!-- .entry-content -->
<p><?php _e( 'Pressbooks is easy-to-use book writing software that lets you create a book in all the formats you need to publish.', 'pressbooks-aldine' ); ?></p> </article><!-- #post-<?php the_ID(); ?> -->
<a class="button" href="<?php echo network_home_url( '/about/' ); ?>"><?php _e( 'Learn More', 'pressbooks-aldine' ) ?></a>
</div>
</div>
<?php endif; ?>
<?php if ( get_option( 'pb_front_page_catalog' ) ) : ?> <?php if ( get_option( 'pb_front_page_catalog' ) ) : ?>
<div id="latest-titles" class="latest-books"> <div id="latest-titles" class="latest-books">
<h3><?php echo $latest_books_title; ?></h3> <h3><?php echo $latest_books_title; ?></h3>
@ -57,4 +52,4 @@ else : ?>
</div> </div>
</div> </div>
<?php endif; ?> <?php endif; ?>
</div> </div>

1
webpack.mix.js

@ -35,6 +35,7 @@ mix.browserSync( {
// Sass // Sass
mix.sass( `${assets}/styles/aldine.scss`, `${dist}/styles/aldine.css` ); mix.sass( `${assets}/styles/aldine.scss`, `${dist}/styles/aldine.css` );
mix.sass( `${assets}/styles/editor.scss`, `${dist}/styles/editor.css` );
// Javascript // Javascript
mix.autoload( { jquery: [ '$', 'window.jQuery', 'jQuery' ] } ); mix.autoload( { jquery: [ '$', 'window.jQuery', 'jQuery' ] } );

Loading…
Cancel
Save