From 4618a9ac4bbba6ebde255ce6de0ee9484153293f Mon Sep 17 00:00:00 2001 From: David Cramer Date: Wed, 11 Apr 2018 10:12:44 +0200 Subject: [PATCH 01/22] update ignores --- .gitignore | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 2f42e60..8ff3991 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,22 @@ -.DS_Store -vendor -node_modules -.idea +# Ignore everything: +/* + +# Whitelist what you want tracked: +!/dev/ +!/languages/ + +!.babelrc +!composer.json +!composer.lock +!.editorconfig +!.eslintignore +!.eslintrc.json +!.gitignore +!gulpfile.bable.js +!LICENSE +!package-lock.json +!package.json +!phpcs.xml.dist +!README.md +!screenshot.png +!.travis.yml From 183d75c410f9455450f9e9ae6e75b678db805c76 Mon Sep 17 00:00:00 2001 From: David Cramer Date: Wed, 11 Apr 2018 10:14:41 +0200 Subject: [PATCH 02/22] update ignores --- .gitignore | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 8ff3991..74e5a2e 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,7 @@ !.babelrc !composer.json -!composer.lock +composer.lock !.editorconfig !.eslintignore !.eslintrc.json @@ -16,7 +16,7 @@ !LICENSE !package-lock.json !package.json -!phpcs.xml.dist +phpcs.xml.dist !README.md !screenshot.png !.travis.yml From 162af5899a2e467c3e0fb25d30b66894d7b96e6d Mon Sep 17 00:00:00 2001 From: David Cramer Date: Wed, 11 Apr 2018 10:15:52 +0200 Subject: [PATCH 03/22] update ignores --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 74e5a2e..198eedd 100644 --- a/.gitignore +++ b/.gitignore @@ -14,7 +14,7 @@ composer.lock !.gitignore !gulpfile.bable.js !LICENSE -!package-lock.json +package-lock.json !package.json phpcs.xml.dist !README.md From 5fb53cb81f3e9977b452bb0271bd9c6e9dbf337b Mon Sep 17 00:00:00 2001 From: David Cramer Date: Wed, 11 Apr 2018 10:42:30 +0200 Subject: [PATCH 04/22] bring in PSTT them and arrange taxonomies and CPT into ./dev --- composer.json | 11 +- dev/404.php | 60 ++ dev/comments.php | 78 ++ dev/config/cssVariables.json | 16 + dev/config/themeConfig.js | 28 + dev/css/comments.css | 10 + dev/css/content.css | 436 +++++++++ dev/css/front-page.css | 46 + dev/css/sidebar.css | 13 + dev/css/widgets.css | 175 ++++ dev/footer.php | 41 + dev/functions.php | 296 ++++++ dev/header.php | 52 ++ .../inc/classes}/class-amp-travel-cpt.php | 0 .../classes}/class-amp-travel-taxonomies.php | 0 dev/inc/customizer.php | 59 ++ dev/inc/jetpack.php | 58 ++ dev/inc/template-functions.php | 125 +++ dev/inc/template-tags.php | 249 +++++ dev/index.php | 66 ++ dev/js/customizer.js | 42 + dev/js/navigation.js | 125 +++ dev/js/skip-link-focus-fix.js | 31 + dev/optional/archive.php | 53 ++ dev/optional/attachment.php | 37 + dev/optional/category.php | 56 ++ dev/optional/custom-page-template.php | 39 + dev/optional/custom-post-template.php | 39 + dev/optional/front-page.php | 46 + dev/optional/page.php | 34 + dev/optional/search.php | 53 ++ dev/optional/single.php | 34 + dev/optional/singular.php | 37 + dev/pluggable/custom-header.php | 76 ++ dev/sidebar.php | 19 + dev/style.css | 884 ++++++++++++++++++ dev/template-parts/content-attachment.php | 60 ++ dev/template-parts/content-none.php | 54 ++ dev/template-parts/content-page.php | 62 ++ dev/template-parts/content-search.php | 35 + dev/template-parts/content.php | 80 ++ functions.php | 279 +++++- index.php | 64 +- languages/readme.txt | 7 + package.json | 81 +- phpcs.xml.dist | 76 +- screenshot.png | Bin 0 -> 264 bytes style.css | 4 +- 48 files changed, 4184 insertions(+), 42 deletions(-) create mode 100644 dev/404.php create mode 100644 dev/comments.php create mode 100644 dev/config/cssVariables.json create mode 100644 dev/config/themeConfig.js create mode 100644 dev/css/comments.css create mode 100644 dev/css/content.css create mode 100644 dev/css/front-page.css create mode 100644 dev/css/sidebar.css create mode 100644 dev/css/widgets.css create mode 100644 dev/footer.php create mode 100644 dev/functions.php create mode 100644 dev/header.php rename {includes => dev/inc/classes}/class-amp-travel-cpt.php (100%) rename {includes => dev/inc/classes}/class-amp-travel-taxonomies.php (100%) create mode 100644 dev/inc/customizer.php create mode 100644 dev/inc/jetpack.php create mode 100644 dev/inc/template-functions.php create mode 100644 dev/inc/template-tags.php create mode 100644 dev/index.php create mode 100644 dev/js/customizer.js create mode 100644 dev/js/navigation.js create mode 100644 dev/js/skip-link-focus-fix.js create mode 100644 dev/optional/archive.php create mode 100644 dev/optional/attachment.php create mode 100644 dev/optional/category.php create mode 100644 dev/optional/custom-page-template.php create mode 100644 dev/optional/custom-post-template.php create mode 100644 dev/optional/front-page.php create mode 100644 dev/optional/page.php create mode 100644 dev/optional/search.php create mode 100644 dev/optional/single.php create mode 100644 dev/optional/singular.php create mode 100644 dev/pluggable/custom-header.php create mode 100644 dev/sidebar.php create mode 100644 dev/style.css create mode 100644 dev/template-parts/content-attachment.php create mode 100644 dev/template-parts/content-none.php create mode 100644 dev/template-parts/content-page.php create mode 100644 dev/template-parts/content-search.php create mode 100644 dev/template-parts/content.php create mode 100644 languages/readme.txt create mode 100644 screenshot.png diff --git a/composer.json b/composer.json index 8f23eff..6684b48 100644 --- a/composer.json +++ b/composer.json @@ -1,11 +1,14 @@ { - "name": "travel/theme", - "description": "WordPress Travel theme", + "name": "morten/pstt", + "description": "A progressive starter theme for WordPress", "type": "wordpress-theme", - "license": "GPL-2.0+", + "license": "GPL-2.0", "require-dev": { - "wp-coding-standards/wpcs": "^0.14.0", + "wp-coding-standards/wpcs": "^0.14.1", "dealerdirect/phpcodesniffer-composer-installer": "^0.4.4", "wimg/php-compatibility": "^8.1" + }, + "require": { + "squizlabs/php_codesniffer": "^3.2" } } diff --git a/dev/404.php b/dev/404.php new file mode 100644 index 0000000..ad3c20b --- /dev/null +++ b/dev/404.php @@ -0,0 +1,60 @@ + + +
+ +
+ + +
+

+ + + +
+

+
    + 'count', + 'order' => 'DESC', + 'show_count' => 1, + 'title_li' => '', + 'number' => 10, + ) + ); + ?> +
+
+ + ' . sprintf( esc_html__( 'Try looking in the monthly archives. %1$s', 'pstt' ), convert_smilies( ':)' ) ) . '

'; + the_widget( 'WP_Widget_Archives', 'dropdown=1', "after_title=$archive_content" ); + + the_widget( 'WP_Widget_Tag_Cloud' ); + ?> + +
+
+ +
+ + + + +
+ + +

+ ' . get_the_title() . '' + ); + } else { + printf( // WPCS: XSS OK. + /* translators: 1: comment count number, 2: title. */ + esc_html( _nx( '%1$s thought on “%2$s”', '%1$s thoughts on “%2$s”', $comment_count, 'comments title', 'pstt' ) ), + number_format_i18n( $comment_count ), + '' . get_the_title() . '' + ); + } + ?> +

+ + + +
    + 'ol', + 'short_ping' => true, + ) + ); + ?> +
+ + +

+ + +
diff --git a/dev/config/cssVariables.json b/dev/config/cssVariables.json new file mode 100644 index 0000000..3ae3937 --- /dev/null +++ b/dev/config/cssVariables.json @@ -0,0 +1,16 @@ +{ + "variables": { + "global-font-color": "#333", + "global-font-family": "'Crimson Text', serif", + "global-font-size": "20", + "global-font-line-height": "1.4", + "highlight-font-family": "'Roboto Condensed', sans-serif", + "content-width": "45" + }, + "queries": { + "narrow-menu-query": "screen and (max-width: 37.5em)", + "wide-menu-query": "screen and (min-width: 37.5em)", + "content-query": "screen and (min-width: 48em)", + "sidebar-query": "screen and (min-width: 60em)" + } +} diff --git a/dev/config/themeConfig.js b/dev/config/themeConfig.js new file mode 100644 index 0000000..43d051a --- /dev/null +++ b/dev/config/themeConfig.js @@ -0,0 +1,28 @@ +'use strict'; + +module.exports = { + theme: { + name: 'Travel', + domain: 'travel', + author: 'XWP', + browserslist: [ // See https://github.com/browserslist/browserslist + '> 1%', + 'last 2 versions' + ] + }, + browserSync: { + live: false, + proxyURL: 'ptsk.test:8888', + bypassPort: '8181' + }, + themeSupports: { + amp: true + }, + export: { + compress: true + }, + debug: { + styles: false, // Render verbose CSS for debugging. + scripts: false // Render verbose JS for debugging. + } +}; diff --git a/dev/css/comments.css b/dev/css/comments.css new file mode 100644 index 0000000..0ebfa77 --- /dev/null +++ b/dev/css/comments.css @@ -0,0 +1,10 @@ +/*-------------------------------------------------------------- +# Comments +--------------------------------------------------------------*/ +.comment-content a { + word-wrap: break-word; +} + +.bypostauthor { + display: block; +} diff --git a/dev/css/content.css b/dev/css/content.css new file mode 100644 index 0000000..b294880 --- /dev/null +++ b/dev/css/content.css @@ -0,0 +1,436 @@ +/*-------------------------------------------------------------- +>>> TABLE OF CONTENTS: +---------------------------------------------------------------- +# Post and page content + # Alignments + # Blocks + # Media + # Captions + # Galleries + # Comments +--------------------------------------------------------------*/ +/*-------------------------------------------------------------- +# Post and page content +--------------------------------------------------------------*/ +/* Custom rule for sticky posts: +.sticky { + +} +*/ + +.hentry { + margin-bottom: 1rem; +} + +.entry-meta, +.entry-footer { + font-family: var(--highlight-font-family); + font-size: 80%; +} + +/* Hides the update date and time. */ +.updated:not(.published) { + display: none; +} + +.post-thumbnail img { + margin: 0 auto; +} + +.page-content, +.entry-content, +.entry-summary { + margin: 1.5em 0 0; +} + +.page-content > *, +.entry-content > *, +.entry-summary > * { + margin-right: auto; + margin-left: auto; + padding-right: 24px; + padding-right: 1.5rem; + padding-left: 24px; + padding-left: 1.5rem; + max-width: calc(var(--content-width) * 16)px; /* Fallback for older browsers. */ + max-width: var(--content-width)rem; +} + +.page-title, +.entry-header, +.entry-footer, +.site-info, +.post-navigation, +.page-navigation, +.comments-area { + margin: 1.5em auto; + padding-right: 24px; + padding-right: 1.5rem; + padding-left: 24px; + padding-left: 1.5rem; + max-width: calc(var(--content-width) * 16)px; /* Fallback for older browsers. */ + max-width: var(--content-width)rem; +} + +@media (--content-query) { + .page-content > *, + .entry-content > *, + .entry-summary > *, + .page-title, + .entry-header, + .entry-footer, + .site-info, + .post-navigation, + .page-navigation, + .comments-area { + padding-left: 0px; + padding-right: 0px; + } +} + +.page-links { + clear: both; + margin: 0 0 1.5em; +} + +.entry-footer span { + margin-right: 1em; +} + +.entry-footer { + clear: both; + padding: 1.5em 1.5rem 3em; + border-bottom: 1px solid #111; +} + +@media (--content-query) { + .entry-footer { + padding-right: 0; + padding-left: 0; + } +} +/*-------------------------------------------------------------- +## Alignments +--------------------------------------------------------------*/ +.alignleft { + float: left; + margin-right: 1.5rem; +} + +.alignright { + float: right; + margin-left: 1.5rem; +} + +.aligncenter { + clear: both; + display: block; + margin-left: auto; + margin-right: auto; +} + +@media (--content-query) { + + .wp-caption.alignright, + .wp-block-image.alignright { + margin-right: calc((100% - calc(var(--content-width) * 16)px) / 2)px; + margin-right: calc((100% - var(--content-width)rem) / 2)rem; + } + + .wp-caption.alignleft, + .wp-block-image.alignleft { + margin-right: calc((100% - calc(var(--content-width) * 16)px) / 2)px; + margin-left: calc((100% - var(--content-width)rem) / 2)rem; + } + +} + +/*-------------------------------------------------------------- +## Blocks +--------------------------------------------------------------*/ +/* + * Available block selectors: + + * .wp-block-image + * .wp-block-gallery + * .wp-block-video + * .wp-block-quote + * .wp-block-text-columns + * .wp-block-cover-text + * .wp-block-button + * .wp-block-gallery + * .wp-block-table + * .wp-block-embed + * .wp-block-audio + * .wp-block-pullquote + * .wp-block-preformatted + * .wp-block-code + * .wp-block-verse + + */ + +.entry-content ul, +.entry-content ol { + padding-right: 3em; + padding-left: 3em; +} + +@media (--content-query) { + .entry-content ul, + .entry-content ol { + padding-right: 1.5em; + padding-left: 1.5em; + } +} + +.wp-block-video video { + max-width: var(--content-width)rem; +} + +.alignwide { + max-width: calc(50% + var(--content-width)rem / 2); +} + +.alignfull { + max-width: 100%; +} + +.wp-block-image img { + display: block; + width: 100%; +} + +.wp-block-cover-text p { + padding: 1.5em 1.5em; +} + +@media (--content-query) { + .wp-block-cover-text p { + padding: 1.5em 0; + } + + .entry-content pre { + padding: 1.5em; + } +} + +ul.wp-block-latest-posts.alignwide, +ul.wp-block-latest-posts.alignfull, +ul.wp-block-latest-posts.is-grid.alignwide, +ul.wp-block-latest-posts.is-grid.alignwide { + padding: 0 1.5em; +} + +.wp-block-table { + display: block; + overflow-x: auto; +} + +.wp-block-table table { + border-collapse: collapse; + width: 100% +} + +.wp-block-table td, .wp-block-table th { + padding: .5em; +} + +.entry-content li { + list-style-position: outside; +} + +/* Responsive video embed magic stuff: */ +.wp-block-embed.type-video > .wp-block-embed__wrapper { + position: relative; + width: 100%; + height: 0; + padding-top: 56.25%; +} + +.wp-block-embed.type-video > .wp-block-embed__wrapper > iframe { + position: absolute; + width: 100%; + height: 100%; + top: 0; + left: 0; + bottom: 0; + right: 0; +} + + + +/*-------------------------------------------------------------- +## Media +--------------------------------------------------------------*/ +.page-content .wp-smiley, +.entry-content .wp-smiley, +.comment-content .wp-smiley { + border: none; + margin-bottom: 0; + margin-top: 0; + padding: 0; +} + +/* Make sure embeds and iframes fit their containers. */ +embed, +iframe, +object { + max-width: 100%; +} + +/* Make sure logo link wraps around logo image. */ +.custom-logo-link { + display: inline-block; +} + +/*-------------------------------------------------------------- +### Captions +--------------------------------------------------------------*/ +.wp-caption { + margin-bottom: 1.5em; + max-width: 100%; +} + +.wp-caption img[class*="wp-image-"] { + display: block; + margin-left: auto; + margin-right: auto; +} + +.wp-caption .wp-caption-text { + margin: 0.8075em 0; +} + +.wp-caption-text { + text-align: center; +} + +/*-------------------------------------------------------------- +### Gallery Block - overrides core styles +--------------------------------------------------------------*/ + +.wp-block-gallery:not(.components-placeholder) { + margin: 1.5em auto; +} + +/* Override standard ul indentation. */ +.entry-content .wp-block-gallery { + padding-right: 1.5em; + padding-left: 1.5em; +} + +@media screen and (min-width: 48em) { + .entry-content .wp-block-gallery { + padding-right: 0; + padding-left: 0; + } +} + +.wp-block-gallery { + display: grid; + grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); + grid-gap: .5em; +} + +.wp-block-gallery.columns-2 .blocks-gallery-item, +.wp-block-gallery.columns-3 .blocks-gallery-item, +.wp-block-gallery.columns-4 .blocks-gallery-item, +.wp-block-gallery.columns-5 .blocks-gallery-item, +.wp-block-gallery.columns-6 .blocks-gallery-item, +.wp-block-gallery.columns-7 .blocks-gallery-item, +.wp-block-gallery.columns-8 .blocks-gallery-item, +.wp-block-gallery.columns-9 .blocks-gallery-item { + width: 100%; + margin: 0; +} + +@media screen and (min-width: 40em) { + .wp-block-gallery.columns-2 { + grid-template-columns: repeat(2, 1fr); + } + + .wp-block-gallery.columns-3 { + grid-template-columns: repeat(3, 1fr); + } + + .wp-block-gallery.columns-4 { + grid-template-columns: repeat(4, 1fr); + } + + .wp-block-gallery.columns-5 { + grid-template-columns: repeat(5, 1fr); + } + + .wp-block-gallery.columns-6 { + grid-template-columns: repeat(6, 1fr); + } + + .wp-block-gallery.columns-7 { + grid-template-columns: repeat(7, 1fr); + } + + .wp-block-gallery.columns-8 { + grid-template-columns: repeat(8, 1fr); + } + + .wp-block-gallery.columns-9 { + grid-template-columns: repeat(9, 1fr); + } +} +/*-------------------------------------------------------------- +### Galleries (Legacy) +--------------------------------------------------------------*/ +.gallery { + margin-bottom: 1.5em; + display: grid; + grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); + grid-gap: .5em; +} + +@media screen and (min-width: 40em) { + .gallery-columns-2 { + grid-template-columns: repeat(2, 1fr); + } + + .gallery-columns-3 { + grid-template-columns: repeat(3, 1fr); + } + + .gallery-columns-4 { + grid-template-columns: repeat(4, 1fr); + } + + .gallery-columns-5 { + grid-template-columns: repeat(5, 1fr); + } + + .gallery-columns-6 { + grid-template-columns: repeat(6, 1fr); + } + + .gallery-columns-7 { + grid-template-columns: repeat(7, 1fr); + } + + .gallery-columns-8 { + grid-template-columns: repeat(8, 1fr); + } + + .gallery-columns-9 { + grid-template-columns: repeat(9, 1fr); + } +} + +.gallery-item { + padding: .5em; + border: 1px solid rgb(222, 222, 222); +} + +.gallery-icon { + display: flex; + justify-content: center; +} + +.gallery-caption { + font-size: 80%; +} diff --git a/dev/css/front-page.css b/dev/css/front-page.css new file mode 100644 index 0000000..f9516bc --- /dev/null +++ b/dev/css/front-page.css @@ -0,0 +1,46 @@ +/** + * Custom styles for the front-page.php template. + */ + +@media (--sidebar-query) { + .site { + margin: 0 1em; + display: grid; + grid-template-columns: 1fr; + } + + .site-main { + margin-top: 2rem; + display: grid; + grid-template-columns: repeat(4, 1fr); + grid-gap: 2rem; + } + + .post { + grid-column: 2/4; + } + + .post:nth-child(-n+4) { + grid-column: span 2; + margin: 0 4rem; + } + + .post:nth-child(-n+4) .entry-footer { + border-bottom: none; + padding-bottom: 1.5em; + } + + .post:first-of-type { + grid-column: 1/5; + margin: 0; + padding: 1rem 0; + border: 10px solid hsl(240, 100%, 90%); + } + + .primary-sidebar { + grid-column: 4; + grid-row: 3/8; + min-width: 0; + } + +} diff --git a/dev/css/sidebar.css b/dev/css/sidebar.css new file mode 100644 index 0000000..3c6b766 --- /dev/null +++ b/dev/css/sidebar.css @@ -0,0 +1,13 @@ +/*-------------------------------------------------------------- +# Sidebar +--------------------------------------------------------------*/ + +.primary-sidebar { + padding: 1.5rem; +} + +@media (--sidebar-query) { + .primary-sidebar { + padding: 0; + } +} diff --git a/dev/css/widgets.css b/dev/css/widgets.css new file mode 100644 index 0000000..110d976 --- /dev/null +++ b/dev/css/widgets.css @@ -0,0 +1,175 @@ +/*-------------------------------------------------------------- +# Widgets +--------------------------------------------------------------*/ +.widget { + margin: 0 0 1.5em; + /* Make sure select elements fit in widgets. */ +} + +.widget_archive ul, +.widget_categories ul, +.widget_meta ul, +.widget_nav_menu ul, +.widget_recent_comments ul, +.widget_pages ul, +.widget_recent_entries ul, +.widget_rss ul { + margin: 0; + padding: 0; + list-style-type: none; +} + +.widget select { + max-width: 100%; + text-overflow: ellipsis; +} + +/* Archive and Categories widgets */ +.widget_archive li { + color: #7D7D7D; +} + +.widget_categories .children { + padding-top: 0; +} + +/* Search widget. */ +.widget_search .search-submit { + display: none; +} + +/* Pages and Menu widgets */ +.widget_pages .children, +.widget_nav_menu .sub-menu { + padding-top: 0; + padding-bottom: .5em; +} + +.widget_pages a, +.widget_nav_menu a { + display: block; + padding: 1em 0; + text-decoration: none; + border-bottom: 1px dashed gray; +} + +.widget_pages a:hover, .widget_pages a:focus, +.widget_nav_menu a:hover, +.widget_nav_menu a:focus { + text-decoration: none; + border-bottom: 1px dashed gray; +} + +.widget_pages li, +.widget_nav_menu li { + padding: 0; +} + +.widget_pages li ul, +.widget_nav_menu li ul { + margin-left: 1em; +} + +/* Meta widget */ +.widget_meta li { + padding: 0; +} + +/* Recent comments */ +.widget_recent_comments li { + line-height: 1.3em; + padding-bottom: .5em; +} + +.widget_recent_comments a:hover, +.widget_recent_comments a:focus { + padding-left: 0; +} + +/* RSS widget */ +.widget_rss li { + margin-bottom: 1em; +} + +.widget li a.rsswidget { + padding-right: .5em; + font-size: 1em; + line-height: 1.4em; +} + +.rss-date, +.widget_rss cite { + color: #333; + font-size: .8em; +} + +.rssSummary { + padding: .5em 0; + font-size: .8em; + line-height: 1.4em; +} + +/* Search widget */ +.widget_search input[type="search"] { + box-sizing: border-box; + width: 100%; + padding: .5em 1em; + border: 1px solid #c3c3c3; + border-radius: 0; +} + +/* Calendar widget */ +.widget_calendar { + font-weight: 400; +} + +.widget_calendar caption { + padding: .5em 0; + font-size: 1em; + font-weight: 500; + text-align: left; +} + +.widget_calendar thead { + background: transparent; + color: black; +} + +.widget_calendar thead th { + border-bottom-width: 2px; +} + +.widget_calendar td { + padding: .2em; + font-size: .8em; + text-align: center; + background: white; + border: 1px solid #cccccc; +} + +.widget_calendar th { + border: none; + text-align: center; +} + +.widget_calendar .pad { + background: #eaeaea; +} + +.widget_calendar a { + font-weight: 900; + text-decoration: none; +} + +/* Text widget */ +.textwidget { + font-size: 80%; + line-height: 1.3em; +} + +/* Footer widget stylings */ +.footer-widgets { + margin: 2em 0 0; + padding: 1em 0; + background-color: #1a1a1a; +} diff --git a/dev/footer.php b/dev/footer.php new file mode 100644 index 0000000..69a2615 --- /dev/null +++ b/dev/footer.php @@ -0,0 +1,41 @@ + + + + +
+
+ + + + | + PSTT', 'the contributors' ); + ?> +
+
+ + + + + + diff --git a/dev/functions.php b/dev/functions.php new file mode 100644 index 0000000..342347e --- /dev/null +++ b/dev/functions.php @@ -0,0 +1,296 @@ + tag in the document head, and expect WordPress to + * provide it for us. + */ + add_theme_support( 'title-tag' ); + + /** + * Enable support for Post Thumbnails on posts and pages. + * + * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/ + */ + add_theme_support( 'post-thumbnails' ); + + // This theme uses wp_nav_menu() in one location. + register_nav_menus( + array( + 'menu-1' => esc_html__( 'Primary', 'pstt' ), + ) + ); + + /** + * Switch default core markup for search form, comment form, and comments + * to output valid HTML5. + */ + add_theme_support( + 'html5', array( + 'search-form', + 'comment-form', + 'comment-list', + 'gallery', + 'caption', + ) + ); + + // Set up the WordPress core custom background feature. + add_theme_support( + 'custom-background', apply_filters( + 'pstt_custom_background_args', array( + 'default-color' => 'ffffff', + 'default-image' => '', + ) + ) + ); + + // Add theme support for selective refresh for widgets. + add_theme_support( 'customize-selective-refresh-widgets' ); + + /** + * Add support for core custom logo. + * + * @link https://codex.wordpress.org/Theme_Logo + */ + add_theme_support( + 'custom-logo', array( + 'height' => 250, + 'width' => 250, + 'flex-width' => true, + 'flex-height' => true, + ) + ); + + add_theme_support( + 'gutenberg', array( + 'wide-images' => true, + 'colors' => array( + '#0073aa', + '#229fd8', + '#eee', + '#444', + ), + ) + ); + + // customThemeSupports. + + // init custom post type. + new AMP_Travel_CPT(); + // init taxonomies. + new AMP_Travel_Taxonomies(); + + } +endif; +add_action( 'after_setup_theme', 'pstt_setup' ); + +/** + * Set the content width in pixels, based on the theme's design and stylesheet. + * + * Priority 0 to make it available to lower priority callbacks. + * + * @global int $content_width + */ +function pstt_content_width() { + + if ( isset( $GLOBALS['content_width'] ) ) { + $content_width = $GLOBALS['content_width']; + } + + // Check if the sidebar is in use. + if ( is_active_sidebar( 'sidebar-1' ) ) { + $content_width = 864; + } else { + $content_width = 864; + } + + /** + * Filter content width of the theme. + * + * @param int $content_width Content width in pixels. + */ + $GLOBALS['content_width'] = apply_filters( 'pstt_content_width', $content_width ); +} +add_action( 'template_redirect', 'pstt_content_width', 0 ); + +/** + * Register Google Fonts + */ +function pstt_fonts_url() { + $fonts_url = ''; + + /** + * Translator: If Roboto Sans does not support characters in your language, translate this to 'off'. + */ + $lora = esc_html_x( 'on', 'Roboto Sans font: on or off', 'pstt' ); + /** + * Translator: If Crimson Text does not support characters in your language, translate this to 'off'. + */ + $raleway = esc_html_x( 'on', 'Crimson Text font: on or off', 'pstt' ); + + $font_families = array(); + + if ( 'off' !== $lora ) { + $font_families[] = 'Roboto Condensed:300,300i,400,400i'; + } + + if ( 'off' !== $raleway ) { + $font_families[] = 'Crimson Text:400,400i,600,600i'; + } + + if ( in_array( 'on', array( $lora, $raleway ) ) ) { + $query_args = array( + 'family' => urlencode( implode( '|', $font_families ) ), + 'subset' => urlencode( 'latin,latin-ext' ), + ); + + $fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' ); + } + + return esc_url_raw( $fonts_url ); + +} + +/** + * Add preconnect for Google Fonts. + * + * @since Twenty Seventeen 1.0 + * + * @param array $urls URLs to print for resource hints. + * @param string $relation_type The relation type the URLs are printed. + * @return array $urls URLs to print for resource hints. + */ +function pstt_resource_hints( $urls, $relation_type ) { + if ( wp_style_is( 'pstt-fonts', 'queue' ) && 'preconnect' === $relation_type ) { + $urls[] = array( + 'href' => 'https://fonts.gstatic.com', + 'crossorigin', + ); + } + + return $urls; +} +add_filter( 'wp_resource_hints', 'pstt_resource_hints', 10, 2 ); + +/** + * Register widget area. + * + * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar + */ +function pstt_widgets_init() { + register_sidebar( array( + 'name' => esc_html__( 'Sidebar', 'pstt' ), + 'id' => 'sidebar-1', + 'description' => esc_html__( 'Add widgets here.', 'pstt' ), + 'before_widget' => '
', + 'after_widget' => '
', + 'before_title' => '

', + 'after_title' => '

', + ) ); +} +add_action( 'widgets_init', 'pstt_widgets_init' ); + +/** + * Enqueue styles. + */ +function pstt_styles() { + // Add custom fonts, used in the main stylesheet. + wp_enqueue_style( 'pstt-fonts', pstt_fonts_url(), array(), null ); + + // Enqueue main stylesheet. + wp_enqueue_style( 'psttbase-style', get_stylesheet_uri(), array(), '20151215' ); + + // Register component styles that are printed as needed. + wp_register_style( 'pstt-comments', get_theme_file_uri() . '/css/comments.css', array(), '20151215' ); + wp_register_style( 'pstt-content', get_theme_file_uri() . '/css/content.css', array(), '20151215' ); + wp_register_style( 'pstt-sidebar', get_theme_file_uri() . '/css/sidebar.css', array(), '20151215' ); + wp_register_style( 'pstt-widgets', get_theme_file_uri() . '/css/widgets.css', array(), '20151215' ); + wp_register_style( 'pstt-front-page', get_theme_file_uri() . '/css/front-page.css', array(), '20151215' ); +} +add_action( 'wp_enqueue_scripts', 'pstt_styles' ); + +/** + * Enqueue scripts. + */ +function pstt_scripts() { + + if ( ! pstt_is_amp() ) { + wp_enqueue_script( 'pstt-navigation', get_theme_file_uri() . '/js/navigation.js', array(), '20151215', false ); + wp_script_add_data( 'pstt-navigation', 'async', true ); + + wp_enqueue_script( 'pstt-skip-link-focus-fix', get_theme_file_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', false ); + wp_script_add_data( 'pstt-skip-link-focus-fix', 'defer', true ); + + if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { + wp_enqueue_script( 'comment-reply' ); + } + } + +} +add_action( 'wp_enqueue_scripts', 'pstt_scripts' ); + +/** + * Bring in Custom Post Type. + */ +require_once get_template_directory() . '/inc/classes/class-amp-travel-cpt.php'; + +/** + * Bring in Taxonomies. + */ +require_once get_template_directory() . '/inc/classes/class-amp-travel-taxonomies.php'; + +/** + * Implement the Custom Header feature. + */ +require get_template_directory() . '/pluggable/custom-header.php'; + +/** + * Custom template tags for this theme. + */ +require get_template_directory() . '/inc/template-tags.php'; + +/** + * Functions which enhance the theme by hooking into WordPress. + */ +require get_template_directory() . '/inc/template-functions.php'; + +/** + * Customizer additions. + */ +require get_template_directory() . '/inc/customizer.php'; + +/** + * Load Jetpack compatibility file. + */ +if ( defined( 'JETPACK__VERSION' ) ) { + require get_template_directory() . '/inc/jetpack.php'; +} diff --git a/dev/header.php b/dev/header.php new file mode 100644 index 0000000..3931258 --- /dev/null +++ b/dev/header.php @@ -0,0 +1,52 @@ + section and everything up until
+ * + * @link https://developer.wordpress.org/themes/basics/template-files/#template-partials + * + * @package pstt + */ + +?> + +> + + + + + + + + +> +
+ + diff --git a/includes/class-amp-travel-cpt.php b/dev/inc/classes/class-amp-travel-cpt.php similarity index 100% rename from includes/class-amp-travel-cpt.php rename to dev/inc/classes/class-amp-travel-cpt.php diff --git a/includes/class-amp-travel-taxonomies.php b/dev/inc/classes/class-amp-travel-taxonomies.php similarity index 100% rename from includes/class-amp-travel-taxonomies.php rename to dev/inc/classes/class-amp-travel-taxonomies.php diff --git a/dev/inc/customizer.php b/dev/inc/customizer.php new file mode 100644 index 0000000..0cb1f20 --- /dev/null +++ b/dev/inc/customizer.php @@ -0,0 +1,59 @@ +get_setting( 'blogname' )->transport = 'postMessage'; + $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; + $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; + + if ( isset( $wp_customize->selective_refresh ) ) { + $wp_customize->selective_refresh->add_partial( + 'blogname', array( + 'selector' => '.site-title a', + 'render_callback' => 'pstt_customize_partial_blogname', + ) + ); + $wp_customize->selective_refresh->add_partial( + 'blogdescription', array( + 'selector' => '.site-description', + 'render_callback' => 'pstt_customize_partial_blogdescription', + ) + ); + } +} +add_action( 'customize_register', 'pstt_customize_register' ); + +/** + * Render the site title for the selective refresh partial. + * + * @return void + */ +function pstt_customize_partial_blogname() { + bloginfo( 'name' ); +} + +/** + * Render the site tagline for the selective refresh partial. + * + * @return void + */ +function pstt_customize_partial_blogdescription() { + bloginfo( 'description' ); +} + +/** + * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. + */ +function pstt_customize_preview_js() { + wp_enqueue_script( 'pstt-customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20151215', true ); +} +add_action( 'customize_preview_init', 'pstt_customize_preview_js' ); diff --git a/dev/inc/jetpack.php b/dev/inc/jetpack.php new file mode 100644 index 0000000..6f77602 --- /dev/null +++ b/dev/inc/jetpack.php @@ -0,0 +1,58 @@ + 'main', + 'render' => 'pstt_infinite_scroll_render', + 'footer' => 'page', + ) + ); + + // Add theme support for Responsive Videos. + add_theme_support( 'jetpack-responsive-videos' ); + + // Add theme support for Content Options. + add_theme_support( + 'jetpack-content-options', array( + 'post-details' => array( + 'stylesheet' => 'pstt-style', + 'date' => '.posted-on', + 'categories' => '.cat-links', + 'tags' => '.tags-links', + 'author' => '.byline', + 'comment' => '.comments-link', + ), + ) + ); +} +add_action( 'after_setup_theme', 'pstt_jetpack_setup' ); + +/** + * Custom render function for Infinite Scroll. + */ +function pstt_infinite_scroll_render() { + while ( have_posts() ) { + the_post(); + if ( is_search() ) : + get_template_part( 'template-parts/content', 'search' ); + else : + get_template_part( 'template-parts/content', get_post_type() ); + endif; + } +} diff --git a/dev/inc/template-functions.php b/dev/inc/template-functions.php new file mode 100644 index 0000000..c076939 --- /dev/null +++ b/dev/inc/template-functions.php @@ -0,0 +1,125 @@ +'; + } +} +add_action( 'wp_head', 'pstt_pingback_header' ); + +/** + * Adds async/defer attributes to enqueued / registered scripts. + * + * If #12009 lands in WordPress, this function can no-op since it would be handled in core. + * + * @link https://core.trac.wordpress.org/ticket/12009 + * @param string $tag The script tag. + * @param string $handle The script handle. + * @return array + */ +function pstt_filter_script_loader_tag( $tag, $handle ) { + + foreach ( array( 'async', 'defer' ) as $attr ) { + if ( ! wp_scripts()->get_data( $handle, $attr ) ) { + continue; + } + + // Prevent adding attribute when already added in #12009. + if ( ! preg_match( ":\s$attr(=|>|\s):", $tag ) ) { + $tag = preg_replace( ':(?=>):', " $attr", $tag, 1 ); + } + + // Only allow async or defer, not both. + break; + } + + return $tag; +} + +add_filter( 'script_loader_tag', 'pstt_filter_script_loader_tag', 10, 2 ); + +/** + * Generate stylesheet URI. + * + * @param object $wp_styles Registered styles. + * @param string $handle The style handle. + */ +function pstt_get_preload_stylesheet_uri( $wp_styles, $handle ) { + $preload_uri = $wp_styles->registered[ $handle ]->src . '?ver=' . $wp_styles->registered[ $handle ]->ver; + return $preload_uri; +} + +/** + * Adds preload for in-body stylesheets depending on what templates are being used. + * + * @link https://developer.mozilla.org/en-US/docs/Web/HTML/Preloading_content + */ +function pstt_add_body_style() { + + // Get the current template global. + global $template; + + // Get registered styles. + $wp_styles = wp_styles(); + // var_dump($wp_styles->registered['pstt-sidebar']); + + $prelods = array(); + + // Preload content.css. + $preloads['pstt-content'] = pstt_get_preload_stylesheet_uri( $wp_styles, 'pstt-content' ); + + // Preload sidebar.css and widget.css. + if ( is_active_sidebar( 'sidebar-1' ) ) { + $preloads['pstt-sidebar'] = pstt_get_preload_stylesheet_uri( $wp_styles, 'pstt-sidebar' ); + $preloads['pstt-widgets'] = pstt_get_preload_stylesheet_uri( $wp_styles, 'pstt-widgets' ); + } + + // Preload comments.css. + if ( ! post_password_required() && is_singular() && ( comments_open() || get_comments_number() ) ) { + $preloads['pstt-comments'] = pstt_get_preload_stylesheet_uri( $wp_styles, 'pstt-comments' ); + } + + // Preload front-page.css. + if ( 'front-page.php' === basename( $template ) ) { + $preloads['pstt-front-page'] = pstt_get_preload_stylesheet_uri( $wp_styles, 'pstt-front-page' ); + } + + // Output the preload markup in . + foreach ( $preloads as $handle => $src ) { + echo ''; + echo "\n"; + } + +} +add_action( 'wp_head', 'pstt_add_body_style' ); diff --git a/dev/inc/template-tags.php b/dev/inc/template-tags.php new file mode 100644 index 0000000..3633559 --- /dev/null +++ b/dev/inc/template-tags.php @@ -0,0 +1,249 @@ + +
+

+
+ + + + + %2$s'; + if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) { + $time_string = ''; + } + + $time_string = sprintf( + $time_string, + esc_attr( get_the_date( 'c' ) ), + esc_html( get_the_date() ), + esc_attr( get_the_modified_date( 'c' ) ), + esc_html( get_the_modified_date() ) + ); + + $posted_on = sprintf( + /* translators: %s: post date. */ + esc_html_x( 'Posted on %s', 'post date', 'pstt' ), + '' . $time_string . '' + ); + + echo '' . $posted_on . ''; // WPCS: XSS OK. + + } +endif; + +if ( ! function_exists( 'pstt_posted_by' ) ) : + /** + * Prints HTML with meta information for the current author. + */ + function pstt_posted_by() { + $byline = sprintf( + /* translators: %s: post author. */ + esc_html_x( 'by %s', 'post author', 'pstt' ), + '' . esc_html( get_the_author() ) . '' + ); + + echo ''; // WPCS: XSS OK. + + } +endif; + +if ( ! function_exists( 'pstt_attachment_in' ) ) : + /** + * Prints HTML with title and link to original post where attachment was added. + * + * @param object $post object. + */ + function pstt_attachment_in( $post ) { + if ( ! empty( $post->post_parent ) ) : + $postlink = sprintf( + /* translators: %s: original post where attachment was added. */ + esc_html_x( 'in %s', 'original post', 'pstt' ), + '' . esc_html( get_the_title( $post->post_parent ) ) . '' + ); + + echo ' ' . $postlink . ''; // WPCS: XSS OK. + + endif; + + } +endif; + +if ( ! function_exists( 'pstt_the_attachment_navigation' ) ) : + /** + * Prints HTML with for navigation to previous and next attachment if available. + */ + function pstt_the_attachment_navigation() { + ?> + + ' . esc_html__( 'Posted in %1$s', 'pstt' ) . '', $categories_list ); // WPCS: XSS OK. + } + + /* translators: used between list items, there is a space after the comma */ + $tags_list = get_the_tag_list( '', esc_html_x( ', ', 'list item separator', 'pstt' ) ); + if ( $tags_list ) { + /* translators: 1: list of tags. */ + printf( '' . esc_html__( 'Tagged %1$s', 'pstt' ) . '', $tags_list ); // WPCS: XSS OK. + } + } + + if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) { + echo ''; + comments_popup_link( + sprintf( + wp_kses( + /* translators: %s: post title */ + __( 'Leave a Comment on %s', 'pstt' ), + array( + 'span' => array( + 'class' => array(), + ), + ) + ), + get_the_title() + ) + ); + echo ''; + } + + edit_post_link( + sprintf( + wp_kses( + /* translators: %s: Name of current post. Only visible to screen readers */ + __( 'Edit %s', 'pstt' ), + array( + 'span' => array( + 'class' => array(), + ), + ) + ), + get_the_title() + ), + '', + '' + ); + } +endif; + +if ( ! function_exists( 'pstt_post_thumbnail' ) ) : + /** + * Displays an optional post thumbnail. + * + * Wraps the post thumbnail in an anchor element on index views, or a div + * element when on single views. + */ + function pstt_post_thumbnail() { + if ( post_password_required() || is_attachment() || ! has_post_thumbnail() ) { + return; + } + + if ( is_singular() ) : + ?> + +
+ +
+ + + + + + + +
+ + + +
+ + a, .page_item_has_children > a' ); + + if ( 'ontouchstart' in window ) { + touchStartFn = function( e ) { + var menuItem = this.parentNode, + i; + + if ( ! menuItem.classList.contains( 'focus' ) ) { + e.preventDefault(); + for ( i = 0; i < menuItem.parentNode.children.length; ++i ) { + if ( menuItem === menuItem.parentNode.children[i]) { + continue; + } + menuItem.parentNode.children[i].classList.remove( 'focus' ); + } + menuItem.classList.add( 'focus' ); + } else { + menuItem.classList.remove( 'focus' ); + } + }; + + for ( i = 0; i < parentLink.length; ++i ) { + parentLink[i].addEventListener( 'touchstart', touchStartFn, supportsPassive ? { passive: true } : false ); + } + } + }( container ) ); +} () ); diff --git a/dev/js/skip-link-focus-fix.js b/dev/js/skip-link-focus-fix.js new file mode 100644 index 0000000..18e7225 --- /dev/null +++ b/dev/js/skip-link-focus-fix.js @@ -0,0 +1,31 @@ +/** + * File skip-link-focus-fix.js. + * + * Helps with accessibility for keyboard only users. + * + * Learn more: https://git.io/vWdr2 + */ +( function() { + var isIe = /(trident|msie)/i.test( navigator.userAgent ); + + if ( isIe && document.getElementById && window.addEventListener ) { + window.addEventListener( 'hashchange', function() { + var id = location.hash.substring( 1 ), + element; + + if ( ! ( /^[A-z0-9_-]+$/.test( id ) ) ) { + return; + } + + element = document.getElementById( id ); + + if ( element ) { + if ( ! ( /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) ) { + element.tabIndex = -1; + } + + element.focus(); + } + }, false ); + } +} () ); diff --git a/dev/optional/archive.php b/dev/optional/archive.php new file mode 100644 index 0000000..1b4a128 --- /dev/null +++ b/dev/optional/archive.php @@ -0,0 +1,53 @@ + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + * + * @link https://developer.wordpress.org/themes/functionality/custom-headers/ + * + * @package pstt + */ + +/** + * Set up the WordPress core custom header feature. + * + * @uses pstt_header_style() + */ +function pstt_custom_header_setup() { + add_theme_support( + 'custom-header', apply_filters( + 'pstt_custom_header_args', array( + 'default-image' => '', + 'default-text-color' => '000000', + 'width' => 1000, + 'height' => 250, + 'flex-height' => true, + 'wp-head-callback' => 'pstt_header_style', + ) + ) + ); +} +add_action( 'after_setup_theme', 'pstt_custom_header_setup' ); + +if ( ! function_exists( 'pstt_header_style' ) ) : + /** + * Styles the header image and text displayed on the blog. + * + * @see pstt_custom_header_setup(). + */ + function pstt_header_style() { + $header_text_color = get_header_textcolor(); + + /* + * If no custom options for text are set, let's bail. + * get_header_textcolor() options: Any hex value, 'blank' to hide text. Default: add_theme_support( 'custom-header' ). + */ + if ( get_theme_support( 'custom-header', 'default-text-color' ) === $header_text_color ) { + return; + } + + // If we get this far, we have custom styles. Let's do this. + ?> + + + + + + diff --git a/dev/style.css b/dev/style.css new file mode 100644 index 0000000..10970a7 --- /dev/null +++ b/dev/style.css @@ -0,0 +1,884 @@ +/*! +Theme Name: Travel +Theme URI: https://wordpress.org/themes/amp-travel +Author: XWP +Author URI: https://xwp.co +Description: WordPress theme built using AMP to make your site lightning fast. +Version: 1.0.0 +License: GNU General Public License v2 or later +License URI: LICENSE +Text Domain: pstt +Tags: custom-background, custom-logo, custom-menu, featured-images, threaded-comments, translation-ready + +This theme, like WordPress, is licensed under the GPL. +Use it to make something cool, have fun, and share what you've learned with others. + +CSS normalization based in part on normalize.css by +Nicolas Gallagher and Jonathan Neal http://necolas.github.io/normalize.css/ +*/ +/*-------------------------------------------------------------- +>>> TABLE OF CONTENTS: +---------------------------------------------------------------- +# Normalize +# Accessibility +# Layout +# Typography +# Elements +# Links +# Forms +# Header + # Main navigation menu +# Content navigation +# Footer +# Infinite scroll +--------------------------------------------------------------*/ +/*-------------------------------------------------------------- +# Normalize +--------------------------------------------------------------*/ +/*! normalize.css v8.0.0 | MIT License | github.com/necolas/normalize.css */ + +/* Document + ========================================================================== */ + +/** + * 1. Correct the line height in all browsers. + * 2. Prevent adjustments of font size after orientation changes in iOS. + */ + + html { + line-height: 1.15; /* 1 */ + -webkit-text-size-adjust: 100%; /* 2 */ +} + +/* Sections + ========================================================================== */ + +/** + * Remove the margin in all browsers. + */ + +body { + margin: 0; +} + +link { + display: none; +} + +/** + * Correct the font size and margin on `h1` elements within `section` and + * `article` contexts in Chrome, Firefox, and Safari. + */ + +h1 { + font-size: 2em; + margin: 0.67em 0; +} + +/* Grouping content + ========================================================================== */ + +/** + * 1. Add the correct box sizing in Firefox. + * 2. Show the overflow in Edge and IE. + */ + +hr { + box-sizing: content-box; /* 1 */ + height: 0; /* 1 */ + overflow: visible; /* 2 */ +} + +/** + * 1. Correct the inheritance and scaling of font size in all browsers. + * 2. Correct the odd `em` font sizing in all browsers. + */ + +pre { + font-family: monospace, monospace; /* 1 */ + font-size: 1em; /* 2 */ +} + +/* Text-level semantics + ========================================================================== */ + +/** + * Remove the gray background on active links in IE 10. + */ + +a { + background-color: transparent; +} + +/** + * 1. Remove the bottom border in Chrome 57- + * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari. + */ + +abbr[title] { + border-bottom: none; /* 1 */ + text-decoration: underline; /* 2 */ + text-decoration: underline dotted; /* 2 */ /* phpcs:ignore */ +} + +/** + * Add the correct font weight in Chrome, Edge, and Safari. + */ + +b, +strong { + font-weight: bolder; +} + +/** + * 1. Correct the inheritance and scaling of font size in all browsers. + * 2. Correct the odd `em` font sizing in all browsers. + */ + +code, +kbd, +samp { + font-family: monospace, monospace; /* 1 */ + font-size: 1em; /* 2 */ +} + +/** + * Add the correct font size in all browsers. + */ + +small { + font-size: 80%; +} + +/** + * Prevent `sub` and `sup` elements from affecting the line height in + * all browsers. + */ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sub { + bottom: -0.25em; +} + +sup { + top: -0.5em; +} + +/* Embedded content + ========================================================================== */ + +/** + * Remove the border on images inside links in IE 10. + */ + +img { + border-style: none; +} + +/* Forms + ========================================================================== */ + +/** + * 1. Change the font styles in all browsers. + * 2. Remove the margin in Firefox and Safari. + */ + +button, +input, +optgroup, +select, +textarea { + font-family: inherit; /* 1 */ + font-size: 100%; /* 1 */ + line-height: 1.15; /* 1 */ + margin: 0; /* 2 */ +} + +/** + * Show the overflow in IE. + * 1. Show the overflow in Edge. + */ + +button, +input { /* 1 */ + overflow: visible; +} + +/** + * Remove the inheritance of text transform in Edge, Firefox, and IE. + * 1. Remove the inheritance of text transform in Firefox. + */ + +button, +select { /* 1 */ + text-transform: none; +} + +/** + * Correct the inability to style clickable types in iOS and Safari. + */ + +button, +[type="button"], +[type="reset"], +[type="submit"] { + -webkit-appearance: button; +} + +/** + * Remove the inner border and padding in Firefox. + */ + +button::-moz-focus-inner, +[type="button"]::-moz-focus-inner, +[type="reset"]::-moz-focus-inner, +[type="submit"]::-moz-focus-inner { + border-style: none; + padding: 0; +} + +/** + * Restore the focus styles unset by the previous rule. + */ + +button:-moz-focusring, +[type="button"]:-moz-focusring, +[type="reset"]:-moz-focusring, +[type="submit"]:-moz-focusring { + outline: 1px dotted ButtonText; +} + +/** + * Correct the padding in Firefox. + */ + +fieldset { + padding: 0.35em 0.75em 0.625em; +} + +/** + * 1. Correct the text wrapping in Edge and IE. + * 2. Correct the color inheritance from `fieldset` elements in IE. + * 3. Remove the padding so developers are not caught out when they zero out + * `fieldset` elements in all browsers. + */ + +legend { + box-sizing: border-box; /* 1 */ + color: inherit; /* 2 */ + display: table; /* 1 */ + max-width: 100%; /* 1 */ + padding: 0; /* 3 */ + white-space: normal; /* 1 */ +} + +/** + * Add the correct vertical alignment in Chrome, Firefox, and Opera. + */ + +progress { + vertical-align: baseline; +} + +/** + * Remove the default vertical scrollbar in IE 10+. + */ + +textarea { + overflow: auto; +} + +/** + * 1. Add the correct box sizing in IE 10. + * 2. Remove the padding in IE 10. + */ + +[type="checkbox"], +[type="radio"] { + box-sizing: border-box; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Correct the cursor style of increment and decrement buttons in Chrome. + */ + +[type="number"]::-webkit-inner-spin-button, +[type="number"]::-webkit-outer-spin-button { + height: auto; +} + +/** + * 1. Correct the odd appearance in Chrome and Safari. + * 2. Correct the outline style in Safari. + */ + +[type="search"] { + -webkit-appearance: textfield; /* 1 */ + outline-offset: -2px; /* 2 */ +} + +/** + * Remove the inner padding in Chrome and Safari on macOS. + */ + +[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} + +/** + * 1. Correct the inability to style clickable types in iOS and Safari. + * 2. Change font properties to `inherit` in Safari. + */ + +::-webkit-file-upload-button { + -webkit-appearance: button; /* 1 */ + font: inherit; /* 2 */ +} + +/* Interactive + ========================================================================== */ + +/* + * Add the correct display in Edge, IE 10+, and Firefox. + */ + +details { + display: block; +} + +/* + * Add the correct display in all browsers. + */ + +summary { + display: list-item; +} + +/* Misc + ========================================================================== */ + +/** + * Add the correct display in IE 10+. + */ + +template { + display: none; +} + +/** + * Add the correct display in IE 10. + */ + +[hidden] { + display: none; +} + +/*-------------------------------------------------------------- +# Accessibility +--------------------------------------------------------------*/ +/* Text meant only for screen readers. */ +.screen-reader-text { + clip: rect(1px, 1px, 1px, 1px); + position: absolute !important; + height: 1px; + width: 1px; + overflow: hidden; + word-wrap: normal !important; + /* Many screen reader and browser combinations announce broken words as they would appear visually. */ +} + +.screen-reader-text:focus { + background-color: #f1f1f1; + border-radius: 3px; + box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6); + clip: auto !important; + color: #21759b; + display: block; + font-size: 14px; + font-size: 0.875rem; + font-weight: bold; + height: auto; + left: 5px; + line-height: normal; + padding: 15px 23px 14px; + text-decoration: none; + top: 5px; + width: auto; + z-index: 100000; + /* Above WP toolbar. */ +} + +/* Do not show the outline on the skip link target. */ +#primary[tabindex="-1"]:focus { + outline: 0; +} + +/*-------------------------------------------------------------- +# Layouts +--------------------------------------------------------------*/ +.site { + margin: 0 auto; + max-width: 100%; +} + +@media (--sidebar-query) { + .has-sidebar .site { + margin: 0 1em; + display: grid; + grid-template-columns: 3fr 1fr; + grid-gap: 2rem; + justify-content: center; + } + + .site-header { + grid-column: span 2; + } + + .site-main { + grid-column: 1; + min-width: 0; + } + + .primary-sidebar { + grid-column: 2; + min-width: 0; + } + + .site-footer { + grid-column: span 2; + } +} + +/*-------------------------------------------------------------- +# Typography +--------------------------------------------------------------*/ +body, +button, +input, +select, +optgroup, +textarea { + color: var(--global-font-color); + font-family: var(--global-font-family); + font-size: var(--global-font-size)px; + font-size: calc(var(--global-font-size) / 16)rem; + line-height: var(--global-font-line-height); +} + +h1, h2, h3, h4, h5, h6 { + font-family: var(--highlight-font-family); + color: #32373c; + clear: both; +} + +.entry-header h1.entry-title { + font-size: 32px; + font-size: 2rem; + line-height: 1.4; + margin: 1em 0; +} + +dfn, cite, em, i { + font-style: italic; +} + +blockquote { + margin: 0 1.5em; +} + +address { + margin: 0 0 1.5em; +} + +pre { + background: #eee; + font-family: "Courier 10 Pitch", Courier, monospace; + font-size: 15px; + font-size: 0.9375rem; + line-height: 1.6; + margin-bottom: 1.6em; + max-width: 100%; + overflow: auto; + padding: 1.6em; +} + +code, kbd, tt, var { + font-family: Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace; + font-size: 15px; + font-size: 0.9375rem; +} + +abbr, acronym { + border-bottom: 1px dotted #666; + cursor: help; +} + +mark, ins { + background: #fff9c0; + text-decoration: none; +} + +big { + font-size: 125%; +} + +/*-------------------------------------------------------------- +# Elements +--------------------------------------------------------------*/ +html { + box-sizing: border-box; +} + +*, +*:before, +*:after { + /* Inherit box-sizing to make it easier to change the property for components that leverage other behavior; see http://css-tricks.com/inheriting-box-sizing-probably-slightly-better-best-practice/ */ + box-sizing: inherit; +} + +body { + background: #fff; + /* Fallback for when there is no custom background color defined. */ } + +blockquote, q { + quotes: "" ""; +} + +hr { + background-color: #ccc; + border: 0; + height: 1px; + margin-bottom: 1.5em; +} + +ul, ol { + margin: 0 0 1.5em 3em; +} + +ul { + list-style: disc; +} + +ol { + list-style: decimal; +} + +li > ul, +li > ol { + margin-bottom: 0; + margin-left: 1.5em; +} + +dt { + font-weight: bold; +} + +dd { + margin: 0 1.5em 1.5em; +} + +img { + display: block; + height: auto; + max-width: 100%; +} + +figure { + /* Extra wide images within figure tags don't overflow the content area. */ + margin: .5em 0; +} + +table { + margin: 0 0 1.5em; + width: 100%; +} + +/*-------------------------------------------------------------- +# Links +--------------------------------------------------------------*/ +a { + color: #0073aa; +} + +a:visited { + color: #333; +} + +a:hover, a:focus, a:active { + color: #00a0d2; +} + +a:focus { + outline: thin dotted; +} + +a:hover, a:active { + outline: 0; +} + +/*-------------------------------------------------------------- +# Forms +--------------------------------------------------------------*/ +button, +input[type="button"], +input[type="reset"], +input[type="submit"] { + border: 1px solid; + border-color: #ccc #ccc #bbb; + border-radius: 3px; + background: #e6e6e6; + color: rgba(0, 0, 0, 0.8); + font-size: 12px; + font-size: 0.75rem; + line-height: 1; + padding: .6em 1em .4em; +} + +button:hover, +input[type="button"]:hover, +input[type="reset"]:hover, +input[type="submit"]:hover { + border-color: #ccc #bbb #aaa; +} + +button:active, button:focus, +input[type="button"]:active, +input[type="button"]:focus, +input[type="reset"]:active, +input[type="reset"]:focus, +input[type="submit"]:active, +input[type="submit"]:focus { + border-color: #aaa #bbb #bbb; +} + +input[type="text"], +input[type="email"], +input[type="url"], +input[type="password"], +input[type="search"], +input[type="number"], +input[type="tel"], +input[type="range"], +input[type="date"], +input[type="month"], +input[type="week"], +input[type="time"], +input[type="datetime"], +input[type="datetime-local"], +input[type="color"], +textarea { + color: #666; + border: 1px solid #ccc; + border-radius: 3px; + padding: 3px; +} + +input[type="text"]:focus, +input[type="email"]:focus, +input[type="url"]:focus, +input[type="password"]:focus, +input[type="search"]:focus, +input[type="number"]:focus, +input[type="tel"]:focus, +input[type="range"]:focus, +input[type="date"]:focus, +input[type="month"]:focus, +input[type="week"]:focus, +input[type="time"]:focus, +input[type="datetime"]:focus, +input[type="datetime-local"]:focus, +input[type="color"]:focus, +textarea:focus { + color: #111; +} + +select { + border: 1px solid #ccc; +} + +textarea { + width: 100%; +} + +/*-------------------------------------------------------------- +# Header +--------------------------------------------------------------*/ +.site-branding { + text-align: center; + margin: 60px 0 1.75em; +} + +.site-title { + margin: .4375em 1em 0; + font-family: var(--highlight-font-family); + font-size: 38px; + font-weight: bold; + line-height: 1.2; + color: #333332; +} + +.site-title a { + text-decoration: none; + color: inherit; +} + +.site-description { + margin: .4375em 0 0; + font-family: var(--highlight-font-family); + font-size: 17px; + font-weight: inherit; + line-height: 1.4; + word-wrap: break-word; + color: #929292; +} + +/*-------------------------------------------------------------- +## Main navigation menu +--------------------------------------------------------------*/ +.main-navigation { + clear: both; + display: block; + margin: 0 auto; + padding: 0 1em; + max-width: calc(var(--content-width) * 16)px; /* Fallback for older browsers. */ + max-width: var(--content-width)rem; + font-family: var(--highlight-font-family); +} + +.main-navigation ul { + display: none; + list-style: none; + margin: 0; + padding-left: 0; +} + +.main-navigation ul ul { + box-shadow: 0 3px 3px rgba(0, 0, 0, 0.2); + float: left; + position: absolute; + top: 100%; + left: -999em; + z-index: 99999; +} + +.main-navigation ul ul ul { + left: -999em; + top: 0; +} + +.main-navigation ul ul li:hover > ul, +.main-navigation ul ul li.focus > ul { + left: 100%; +} + +.main-navigation ul ul a { + width: 200px; +} + +.main-navigation ul li:hover > ul, +.main-navigation ul li.focus > ul { + display: block; + left: auto; +} + +.main-navigation li { + position: relative; +} + +.main-navigation a { + display: block; + text-decoration: none; +} + +@media (--narrow-menu-query) { + /* Small menu. */ + .menu-toggle, + .main-navigation.toggled ul { + display: block; + margin: 0 auto; + } +} + +@media (--wide-menu-query) { + .menu-toggle { + display: none; + } + + .main-navigation ul { + display: flex; + justify-content: center; + flex-wrap: wrap; + } + + .main-navigation a { + padding: 0 .5em; + } +} + +/*-------------------------------------------------------------- +# Content navigation +--------------------------------------------------------------*/ +.site-main .comment-navigation, +.site-main .posts-navigation, +.site-main .post-navigation { + border-bottom: 1px solid #111; + margin: 0 auto 60px; + max-width: 720px; + overflow: hidden; + padding-bottom: 60px; +} + +.nav-links { + display: flex; +} + +.comment-navigation .nav-previous, +.posts-navigation .nav-previous, +.post-navigation .nav-previous { + width: 50%; + flex: 1 0 50%; +} + +.comment-navigation .nav-next, +.posts-navigation .nav-next, +.post-navigation .nav-next { + text-align: end; + flex: 1 0 50%; +} + +.post-navigation-sub span { + color: var(--global-font-color); + text-decoration: none; + display: inline-block; +} + +/*-------------------------------------------------------------- +# Footer +--------------------------------------------------------------*/ +.site-footer { + margin: 1em 0; + opacity: 0.5; +} + +/*-------------------------------------------------------------- +# Infinite scroll +--------------------------------------------------------------*/ +/* Globally hidden elements when Infinite Scroll is supported and in use. */ +.infinite-scroll .posts-navigation, +.infinite-scroll.neverending .site-footer { + /* Theme Footer (when set to scrolling) */ + display: none; +} + +/* When Infinite Scroll has reached its end we need to re-display elements that were hidden (via .neverending) before. */ +.infinity-end.neverending .site-footer { + display: block; +} diff --git a/dev/template-parts/content-attachment.php b/dev/template-parts/content-attachment.php new file mode 100644 index 0000000..fcee307 --- /dev/null +++ b/dev/template-parts/content-attachment.php @@ -0,0 +1,60 @@ + + +
> + +
+ ', '' ); + ?> + + +
+ +
+ +
+ +
+ +
+
+ + + +
+ +
+ +
+
+ +post_parent ) ) : + pstt_the_attachment_navigation(); +endif; + +// 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; diff --git a/dev/template-parts/content-none.php b/dev/template-parts/content-none.php new file mode 100644 index 0000000..974d7ac --- /dev/null +++ b/dev/template-parts/content-none.php @@ -0,0 +1,54 @@ + +
+ + +
+ + +

+ Get started here.', 'pstt' ), + array( + 'a' => array( + 'href' => array(), + ), + ) + ), + esc_url( admin_url( 'post-new.php' ) ) + ); + ?> +

+ + + +

+ + +

+ +
+
diff --git a/dev/template-parts/content-page.php b/dev/template-parts/content-page.php new file mode 100644 index 0000000..4ce650f --- /dev/null +++ b/dev/template-parts/content-page.php @@ -0,0 +1,62 @@ + + +
> +
+ ', '' ); ?> +
+ + + +
+ '', + ) + ); + ?> +
+ + +
+ %s', 'pstt' ), + array( + 'span' => array( + 'class' => array(), + ), + ) + ), + get_the_title() + ), + '', + '' + ); + ?> +
+ +
+ + + + diff --git a/dev/template-parts/content.php b/dev/template-parts/content.php new file mode 100644 index 0000000..a7eae3f --- /dev/null +++ b/dev/template-parts/content.php @@ -0,0 +1,80 @@ + + +
> +
+ ', '' ); + else : + the_title( '

', '

' ); + endif; + + if ( 'post' === get_post_type() ) : + ?> + + +
+ + + +
+ "%s"', 'pstt' ), + array( + 'span' => array( + 'class' => array(), + ), + ) + ), + get_the_title() + ) + ); + + wp_link_pages( + array( + 'before' => '', + ) + ); + ?> +
+ +
+ +
+
+ + '
' . esc_html__( 'Previous:', 'pstt' ) . '
%title', + 'next_text' => '
' . esc_html__( 'Next:', 'pstt' ) . '
%title', + ) + ); + + // 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; +endif; diff --git a/functions.php b/functions.php index 63c668d..2e242d9 100644 --- a/functions.php +++ b/functions.php @@ -1,14 +1,12 @@ tag in the document head, and expect WordPress to + * provide it for us. + */ + add_theme_support( 'title-tag' ); + + /** + * Enable support for Post Thumbnails on posts and pages. + * + * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/ + */ + add_theme_support( 'post-thumbnails' ); + + // This theme uses wp_nav_menu() in one location. + register_nav_menus( + array( + 'menu-1' => esc_html__( 'Primary', 'travel' ), + ) + ); + + /** + * Switch default core markup for search form, comment form, and comments + * to output valid HTML5. + */ + add_theme_support( + 'html5', array( + 'search-form', + 'comment-form', + 'comment-list', + 'gallery', + 'caption', + ) + ); + + // Set up the WordPress core custom background feature. + add_theme_support( + 'custom-background', apply_filters( + 'travel_custom_background_args', array( + 'default-color' => 'ffffff', + 'default-image' => '', + ) + ) + ); + + // Add theme support for selective refresh for widgets. + add_theme_support( 'customize-selective-refresh-widgets' ); + + /** + * Add support for core custom logo. + * + * @link https://codex.wordpress.org/Theme_Logo + */ + add_theme_support( + 'custom-logo', array( + 'height' => 250, + 'width' => 250, + 'flex-width' => true, + 'flex-height' => true, + ) + ); + + add_theme_support( + 'gutenberg', array( + 'wide-images' => true, + 'colors' => array( + '#0073aa', + '#229fd8', + '#eee', + '#444', + ), + ) + ); + + // Add custom theme supports. + add_theme_support( 'amp' ); // init custom post type. new AMP_Travel_CPT(); @@ -35,6 +112,186 @@ function travel_setup() { } endif; - -// Hook into theme after setup. add_action( 'after_setup_theme', 'travel_setup' ); + +/** + * Set the content width in pixels, based on the theme's design and stylesheet. + * + * Priority 0 to make it available to lower priority callbacks. + * + * @global int $content_width + */ +function travel_content_width() { + + if ( isset( $GLOBALS['content_width'] ) ) { + $content_width = $GLOBALS['content_width']; + } + + // Check if the sidebar is in use. + if ( is_active_sidebar( 'sidebar-1' ) ) { + $content_width = 864; + } else { + $content_width = 864; + } + + /** + * Filter content width of the theme. + * + * @param int $content_width Content width in pixels. + */ + $GLOBALS['content_width'] = apply_filters( 'travel_content_width', $content_width ); +} +add_action( 'template_redirect', 'travel_content_width', 0 ); + +/** + * Register Google Fonts + */ +function travel_fonts_url() { + $fonts_url = ''; + + /** + * Translator: If Roboto Sans does not support characters in your language, translate this to 'off'. + */ + $lora = esc_html_x( 'on', 'Roboto Sans font: on or off', 'travel' ); + /** + * Translator: If Crimson Text does not support characters in your language, translate this to 'off'. + */ + $raleway = esc_html_x( 'on', 'Crimson Text font: on or off', 'travel' ); + + $font_families = array(); + + if ( 'off' !== $lora ) { + $font_families[] = 'Roboto Condensed:300,300i,400,400i'; + } + + if ( 'off' !== $raleway ) { + $font_families[] = 'Crimson Text:400,400i,600,600i'; + } + + if ( in_array( 'on', array( $lora, $raleway ) ) ) { + $query_args = array( + 'family' => urlencode( implode( '|', $font_families ) ), + 'subset' => urlencode( 'latin,latin-ext' ), + ); + + $fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' ); + } + + return esc_url_raw( $fonts_url ); + +} + +/** + * Add preconnect for Google Fonts. + * + * @since Twenty Seventeen 1.0 + * + * @param array $urls URLs to print for resource hints. + * @param string $relation_type The relation type the URLs are printed. + * @return array $urls URLs to print for resource hints. + */ +function travel_resource_hints( $urls, $relation_type ) { + if ( wp_style_is( 'travel-fonts', 'queue' ) && 'preconnect' === $relation_type ) { + $urls[] = array( + 'href' => 'https://fonts.gstatic.com', + 'crossorigin', + ); + } + + return $urls; +} +add_filter( 'wp_resource_hints', 'travel_resource_hints', 10, 2 ); + +/** + * Register widget area. + * + * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar + */ +function travel_widgets_init() { + register_sidebar( array( + 'name' => esc_html__( 'Sidebar', 'travel' ), + 'id' => 'sidebar-1', + 'description' => esc_html__( 'Add widgets here.', 'travel' ), + 'before_widget' => '
', + 'after_widget' => '
', + 'before_title' => '

', + 'after_title' => '

', + ) ); +} +add_action( 'widgets_init', 'travel_widgets_init' ); + +/** + * Enqueue styles. + */ +function travel_styles() { + // Add custom fonts, used in the main stylesheet. + wp_enqueue_style( 'travel-fonts', travel_fonts_url(), array(), null ); + + // Enqueue main stylesheet. + wp_enqueue_style( 'travelbase-style', get_stylesheet_uri(), array(), '20151215' ); + + // Register component styles that are printed as needed. + wp_register_style( 'travel-comments', get_theme_file_uri() . '/css/comments.css', array(), '20151215' ); + wp_register_style( 'travel-content', get_theme_file_uri() . '/css/content.css', array(), '20151215' ); + wp_register_style( 'travel-sidebar', get_theme_file_uri() . '/css/sidebar.css', array(), '20151215' ); + wp_register_style( 'travel-widgets', get_theme_file_uri() . '/css/widgets.css', array(), '20151215' ); + wp_register_style( 'travel-front-page', get_theme_file_uri() . '/css/front-page.css', array(), '20151215' ); +} +add_action( 'wp_enqueue_scripts', 'travel_styles' ); + +/** + * Enqueue scripts. + */ +function travel_scripts() { + + if ( ! travel_is_amp() ) { + wp_enqueue_script( 'travel-navigation', get_theme_file_uri() . '/js/navigation.js', array(), '20151215', false ); + wp_script_add_data( 'travel-navigation', 'async', true ); + + wp_enqueue_script( 'travel-skip-link-focus-fix', get_theme_file_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', false ); + wp_script_add_data( 'travel-skip-link-focus-fix', 'defer', true ); + + if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { + wp_enqueue_script( 'comment-reply' ); + } + } + +} +add_action( 'wp_enqueue_scripts', 'travel_scripts' ); + +/** + * Bring in Custom Post Type. + */ +require_once get_template_directory() . '/inc/classes/class-amp-travel-cpt.php'; + +/** + * Bring in Taxonomies. + */ +require_once get_template_directory() . '/inc/classes/class-amp-travel-taxonomies.php'; + +/** + * Implement the Custom Header feature. + */ +require get_template_directory() . '/pluggable/custom-header.php'; + +/** + * Custom template tags for this theme. + */ +require get_template_directory() . '/inc/template-tags.php'; + +/** + * Functions which enhance the theme by hooking into WordPress. + */ +require get_template_directory() . '/inc/template-functions.php'; + +/** + * Customizer additions. + */ +require get_template_directory() . '/inc/customizer.php'; + +/** + * Load Jetpack compatibility file. + */ +if ( defined( 'JETPACK__VERSION' ) ) { + require get_template_directory() . '/inc/jetpack.php'; +} diff --git a/index.php b/index.php index 439cbdf..355dd66 100644 --- a/index.php +++ b/index.php @@ -1,10 +1,66 @@ +get_header(); ?> + +
+ + + /* Increment counter. */ + $post_count++; + + endwhile; + + if ( ! is_singular() ) : + the_posts_navigation(); + endif; + + else : + + get_template_part( 'template-parts/content', 'none' ); + + endif; + ?> + +
+ + A custom set of code standard rules to check for WordPress themes. + + + + + + - . + ./dev/ + + + - + @@ -39,16 +57,23 @@ - + - - + + + - + + + + + + @@ -58,5 +83,42 @@ */node_modules/* */vendor/* - */html/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/screenshot.png b/screenshot.png new file mode 100644 index 0000000000000000000000000000000000000000..5bddc87ca3f27b55706acd9e8d8b4a51cce84ec7 GIT binary patch literal 264 zcmeAS@N?(olHy`uVBq!ia0y~yVA;UHz}&*f3>4{J9JLcjF$egBxB}_rRkpW)6k|z{ zUoeBivm0qZ&Sp;+$B>F!Zw@vBISdU8{;m{X$pm7O2NJ$LZ~*H(@qepeNGRE0sjYol,li>ul{margin-bottom:0;margin-left:1.5em}dt{font-weight:700}dd{margin:0 1.5em 1.5em}img{display:block;height:auto;max-width:100%}figure{margin:.5em 0}table{margin:0 0 1.5em;width:100%}a{color:#0073aa}a:visited{color:#333}a:active,a:focus,a:hover{color:#00a0d2}a:focus{outline:thin dotted}a:active,a:hover{outline:0}button,input[type=button],input[type=reset],input[type=submit]{border:1px solid;border-color:#ccc #ccc #bbb;border-radius:3px;background:#e6e6e6;color:rgba(0,0,0,.8);font-size:12px;font-size:.75rem;line-height:1;padding:.6em 1em .4em}button:hover,input[type=button]:hover,input[type=reset]:hover,input[type=submit]:hover{border-color:#ccc #bbb #aaa}button:active,button:focus,input[type=button]:active,input[type=button]:focus,input[type=reset]:active,input[type=reset]:focus,input[type=submit]:active,input[type=submit]:focus{border-color:#aaa #bbb #bbb}input[type=color],input[type=date],input[type=datetime-local],input[type=datetime],input[type=email],input[type=month],input[type=number],input[type=password],input[type=range],input[type=search],input[type=tel],input[type=text],input[type=time],input[type=url],input[type=week],textarea{color:#666;border:1px solid #ccc;border-radius:3px;padding:3px}input[type=color]:focus,input[type=date]:focus,input[type=datetime-local]:focus,input[type=datetime]:focus,input[type=email]:focus,input[type=month]:focus,input[type=number]:focus,input[type=password]:focus,input[type=range]:focus,input[type=search]:focus,input[type=tel]:focus,input[type=text]:focus,input[type=time]:focus,input[type=url]:focus,input[type=week]:focus,textarea:focus{color:#111}select{border:1px solid #ccc}textarea{width:100%}.site-branding{text-align:center;margin:60px 0 1.75em}.site-title{margin:.4375em 1em 0;font-family:Roboto Condensed,sans-serif;font-size:38px;font-weight:700;line-height:1.2;color:#333332}.site-title a{text-decoration:none;color:inherit}.site-description{margin:.4375em 0 0;font-size:17px;font-weight:inherit;line-height:1.4;word-wrap:break-word;color:#929292}.main-navigation,.site-description{font-family:Roboto Condensed,sans-serif}.main-navigation{clear:both;display:block;margin:0 auto;padding:0 1em;max-width:720px;max-width:45rem}.main-navigation ul{display:none;list-style:none;margin:0;padding-left:0}.main-navigation ul ul{box-shadow:0 3px 3px rgba(0,0,0,.2);float:left;position:absolute;top:100%;left:-999em;z-index:1}.main-navigation ul ul ul{left:-999em;top:0}.main-navigation ul ul li.focus>ul,.main-navigation ul ul li:hover>ul{left:100%}.main-navigation ul ul a{width:200px}.main-navigation ul li.focus>ul,.main-navigation ul li:hover>ul{display:block;left:auto}.main-navigation li{position:relative}.main-navigation a{display:block;text-decoration:none}@media screen and (max-width:37.5em){.main-navigation.toggled ul,.menu-toggle{display:block;margin:0 auto}}@media screen and (min-width:37.5em){.menu-toggle{display:none}.main-navigation ul{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-wrap:wrap;flex-wrap:wrap}.main-navigation a{padding:0 .5em}}.site-main .comment-navigation,.site-main .post-navigation,.site-main .posts-navigation{border-bottom:1px solid #111;margin:0 auto 60px;max-width:720px;overflow:hidden;padding-bottom:60px}.nav-links{display:-ms-flexbox;display:flex}.comment-navigation .nav-previous,.post-navigation .nav-previous,.posts-navigation .nav-previous{width:50%;-ms-flex:1 0 50%;flex:1 0 50%}.comment-navigation .nav-next,.post-navigation .nav-next,.posts-navigation .nav-next{text-align:end;-ms-flex:1 0 50%;flex:1 0 50%}.post-navigation-sub span{color:#333;text-decoration:none;display:inline-block}.site-footer{margin:1em 0;opacity:.5}.infinite-scroll.neverending .site-footer,.infinite-scroll .posts-navigation{display:none}.infinity-end.neverending .site-footer{display:block} \ No newline at end of file From c4504d926f739b80a493cacf1bb042c1a3a59fc1 Mon Sep 17 00:00:00 2001 From: David Cramer Date: Wed, 11 Apr 2018 10:57:42 +0200 Subject: [PATCH 05/22] update ignores --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 198eedd..7f1b09c 100644 --- a/.gitignore +++ b/.gitignore @@ -12,7 +12,7 @@ composer.lock !.eslintignore !.eslintrc.json !.gitignore -!gulpfile.bable.js +gulpfile.bable.js !LICENSE package-lock.json !package.json From 57c779d805d0e51501ebbff5f0c861831a7bd863 Mon Sep 17 00:00:00 2001 From: David Cramer Date: Wed, 11 Apr 2018 10:59:58 +0200 Subject: [PATCH 06/22] update ignores --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 7f1b09c..198eedd 100644 --- a/.gitignore +++ b/.gitignore @@ -12,7 +12,7 @@ composer.lock !.eslintignore !.eslintrc.json !.gitignore -gulpfile.bable.js +!gulpfile.bable.js !LICENSE package-lock.json !package.json From f0d36b66a91237977fc11ca059e7ca248df19c78 Mon Sep 17 00:00:00 2001 From: David Cramer Date: Wed, 11 Apr 2018 11:13:30 +0200 Subject: [PATCH 07/22] install tasks and docs --- .eslintignore | 12 +- README.md | 17 ++- gulpfile.babel.js | 274 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 299 insertions(+), 4 deletions(-) create mode 100644 gulpfile.babel.js diff --git a/.eslintignore b/.eslintignore index 4cd1606..00f14c7 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,3 +1,9 @@ -**/*.min.js -**/node_modules/** -**/vendor/** +/dev/js/libs/** +/node_modules/** +/vendor/** +/js/customizer.js +/js/navigation.js +./dev/config/** + +# Because parsing error: 'import' and 'export' may appear only with 'sourceType: module' +/gulpfile.babel.js diff --git a/README.md b/README.md index d02a579..ec9b3f0 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,21 @@ A WordPress theme showcasing canonical AMP functionality. Custom theme based on the [AMP Start Travel Theme](https://ampstart-iframes.firebaseapp.com/templates/travel/travel.amp), developed by XWP. +## Developing +Built on [PSTT theme](https://github.com/mor10/pstt). + +1. In command line, run `npm install` to install necessary node packages and dependencies. +2. In command line, run `composer install` to install necessary PHP packages and dependencies. +3. In command line, run `npm run build` to generate the theme. + + +Travel uses a [Gulp](https://gulpjs.com/) build process to generate and optimize the code for the theme. All development is done in the `/dev` folder and Gulp preprocesses, transpiles, and compiles the files into the root folder. The root folder files become the active theme. WordPress ignores anything in the `/dev` folder. + +JavaScript files are automatically linted using [ESLint](https://eslint.org/) in accordance with [WordPress Codeing Standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/). + +PHP and CSS files are automatically linted using [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) in accordance with [WordPress Codeing Standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/). To take full advantage of this setup, configure your code editor / IDE to automatically test for the WordPress Coding Standards. More details can be found at the [WordPres Coding Standards Wiki](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki). + + ## Installation ## 1. In your admin panel, go to Appearance > Themes and click the Add New button. @@ -24,4 +39,4 @@ Custom theme based on the [AMP Start Travel Theme](https://ampstart-iframes.fire ## Credits ## * Based on the [AMP Start Travel Theme](https://ampstart-iframes.firebaseapp.com/templates/travel/travel.amp) - +* Built with [PSTT theme](https://github.com/mor10/pstt) diff --git a/gulpfile.babel.js b/gulpfile.babel.js new file mode 100644 index 0000000..da29b73 --- /dev/null +++ b/gulpfile.babel.js @@ -0,0 +1,274 @@ +/* eslint-env es6 */ +'use strict'; + +/** + * To start theme building process, define the theme name below, + * then run "gulp" in command line. + */ + +import gulp from 'gulp'; +import autoprefixer from 'autoprefixer'; +import browserSync from 'browser-sync'; +import cssnano from 'gulp-cssnano'; +import babel from 'gulp-babel'; +import cssnext from 'postcss-cssnext'; +import eslint from 'gulp-eslint'; +import log from 'fancy-log'; +import gulpif from 'gulp-if'; +import image from 'gulp-image'; +import newer from 'gulp-newer'; +import partialImport from 'postcss-partial-import'; +import phpcs from 'gulp-phpcs'; +import postcss from 'gulp-postcss'; +import print from 'gulp-print'; +import replace from 'gulp-string-replace'; +import requireUncached from 'require-uncached'; +import sass from 'gulp-sass'; +import sourcemaps from 'gulp-sourcemaps'; +import sort from 'gulp-sort'; +import tabify from 'gulp-tabify'; +import uglify from 'gulp-uglify'; +import wppot from 'gulp-wp-pot'; +import zip from 'gulp-zip'; + +// Import theme-specific configurations. +var config = require( './dev/config/themeConfig.js' ); + +// Project paths +const paths = { + config: { + cssVars: './dev/config/cssVariables.json' + }, + php: { + src: [ 'dev/**/*.php', '!dev/optional/**/*.*' ], + dest: './' + }, + styles: { + src: [ 'dev/**/*.css', '!dev/optional/**/*.*' ], + dest: './', + sass: [ 'dev/**/*.scss' ] + }, + scripts: { + src: [ 'dev/**/*.js', '!dev/js/libs/**/*.js', '!dev/optional/**/*.*', '!dev/config/**/*' ], + dest: './', + libs: 'dev/js/libs/**/*.js', + libsDest: './js/libs/' + }, + images: { + src: [ 'dev/**/*.{jpg,JPG,png}', '!dev/optional/**/*.*' ], + dest: './' + }, + languages: { + src: [ './**/*.php', '!dev/**/*.php', '!verbose/**/*.php' ], + dest: './languages/' + config.theme.name + '.pot' + }, + verbose: './verbose/', + export: { + src: [ '**/*', '!dev/**/*', '!node_modules', '!node_modules/**/*', '!vendor', '!vendor/**/*', '!.*', '!composer.*', '!gulpfile.*', '!package*.*', '!phpcs.*', '!*.zip' ], + dest: './' + } +}; + +/** + * Conditionally set up BrowserSync. + * Only run BrowserSync if config.browserSync.live = true. + */ + +// Create a BrowserSync instance: +const server = browserSync.create(); + +// Initialize the BrowserSync server conditionally: +function serve( done ) { + if ( config.browserSync.live ) { + server.init( { + proxy: config.browserSync.proxyURL, + port: config.browserSync.bypassPort, + liveReload: true + } ); + } + done(); +} + +// Reload the live site: +function reload( done ) { + config = requireUncached( './dev/config/themeConfig.js' ); + if ( config.browserSync.live ) { + if ( server.paused ) { + server.resume(); + } + server.reload(); + } + else { + server.pause(); + } + done(); +} + +/** + * PHP via PHP Code Sniffer. + */ + +const themeSupportsArray = `// Add custom theme supports. + add_theme_support( 'amp' );`; + +export function php() { + config = requireUncached( './dev/config/themeConfig.js' ); + return gulp.src( paths.php.src ) + .pipe( newer( paths.php.dest ) ) + .pipe( gulpif( config.themeSupports.amp, replace( '// customThemeSupports.', themeSupportsArray ) ) ) + .pipe( phpcs( { + bin: 'vendor/bin/phpcs', + standard: 'WordPress', + warningSeverity: 0 + } ) ) + // Log all problems that was found + .pipe( phpcs.reporter( 'log' ) ) + .pipe( replace( 'PSTT', config.theme.name ) ) + .pipe( replace( 'pstt', config.theme.domain ) ) + .pipe( gulp.dest( paths.verbose ) ) + .pipe( gulp.dest( paths.php.dest ) ); +} + + + + +/** + * Sass, if that's being used. + */ +export function sassStyles() { + return gulp.src( paths.styles.sass, {base: './'} ) + .pipe( sourcemaps.init() ) + .pipe( sass().on( 'error', sass.logError ) ) + .pipe( tabify( 2, true ) ) + .pipe( sourcemaps.write( './maps' ) ) + .pipe( gulp.dest( '.' ) ); +} + +/** + * CSS via PostCSS + CSSNext (includes Autoprefixer by default). + */ +export function styles() { + config = requireUncached( './dev/config/themeConfig.js' ); + + // Reload cssVars every time the task runs. + let cssVars = requireUncached( paths.config.cssVars ); + + return gulp.src( paths.styles.src ) + .pipe( print() ) + .pipe( phpcs( { + bin: 'vendor/bin/phpcs', + standard: 'WordPress', + warningSeverity: 0 + } ) ) + // Log all problems that was found + .pipe( phpcs.reporter( 'log' ) ) + .pipe( postcss( [ + cssnext( { + browsers: config.theme.browserslist, + features: { + customProperties: { + variables: cssVars.variables, + }, + customMedia: { + extensions: cssVars.queries, + } + } + } ) + ] ) ) + .pipe( replace( 'PSTT', config.theme.name ) ) + .pipe( replace( 'pstt', config.theme.domain ) ) + .pipe( gulp.dest( paths.verbose ) ) + .pipe( gulpif( !config.debug.styles, cssnano() ) ) + .pipe( gulp.dest( paths.styles.dest ) ); +} + +/** + * JavaScript via Babel, ESlint, and uglify. + */ +export function scripts() { + config = requireUncached( './dev/config/themeConfig.js' ); + return gulp.src( paths.scripts.src ) + .pipe( newer( paths.scripts.dest ) ) + .pipe( eslint() ) + .pipe( eslint.format() ) + .pipe( babel() ) + .pipe( gulp.dest( paths.verbose ) ) + .pipe( gulpif( !config.debug.styles, uglify() ) ) + .pipe( replace( 'PSTT', config.theme.name ) ) + .pipe( replace( 'pstt', config.theme.domain ) ) + .pipe( gulp.dest( paths.scripts.dest ) ); +} + +/** + * Copy JS libraries without touching them. + */ +export function jsCopy() { + return gulp.src( paths.scripts.libs ) + .pipe( newer( paths.scripts.libsDest ) ) + .pipe( gulp.dest( paths.verbose ) ) + .pipe( gulp.dest( paths.scripts.libsDest ) ); +} + +/** + * Optimize images. + */ +export function images() { + return gulp.src( paths.images.src ) + .pipe( newer( paths.images.dest ) ) + .pipe( image() ) + .pipe( gulp.dest( paths.images.dest ) ); +} + +/** + * Watch everything + */ +export function watch() { + gulp.watch( paths.php.src, gulp.series( php, reload ) ); + gulp.watch( paths.config.cssVars, gulp.series( styles, reload ) ); + gulp.watch( paths.styles.sass, sassStyles ); + gulp.watch( paths.styles.src, gulp.series( styles, reload ) ); + gulp.watch( paths.scripts.src, gulp.series( gulp.parallel( scripts, jsCopy ), reload ) ); + gulp.watch( paths.images.src, gulp.series( images, reload ) ); +} + +/** + * Map out the sequence of events on first load: + */ +const firstRun = gulp.series( php, gulp.parallel( scripts, jsCopy ), sassStyles, styles, images, serve, watch ); + +/** + * Run the whole thing. + */ +export default firstRun; + +/** + * Generate translation files. + */ +export function translate() { + return gulp.src( paths.languages.src ) + .pipe( sort() ) + .pipe( wppot( { + domain: config.theme.name, + package: config.theme.name, + bugReport: config.theme.name, + lastTranslator: config.theme.author + } ) ) + .pipe( gulp.dest( paths.languages.dest ) ); +} + +/** + * Create zip archive from generated theme files. + */ +export function bundle() { + return gulp.src( paths.export.src ) + .pipe( print() ) + .pipe( gulpif( config.export.compress, zip( config.theme.name + '.zip' ), gulp.dest( paths.export.dest + config.theme.name ) ) ) + .pipe( gulpif( config.export.compress, gulp.dest( paths.export.dest ) ) ); +} + +/** + * Export theme for distribution. + */ +const bundleTheme = gulp.series( php, gulp.parallel( scripts, jsCopy ), styles, images, translate, bundle ); + +export { bundleTheme }; From 617ce4d7dd934bcd7c2c4974db4c88a46a817075 Mon Sep 17 00:00:00 2001 From: David Cramer Date: Wed, 11 Apr 2018 11:20:35 +0200 Subject: [PATCH 08/22] add dev-lib --- gulpfile.babel.js | 3 --- package.json | 3 ++- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/gulpfile.babel.js b/gulpfile.babel.js index da29b73..818bf39 100644 --- a/gulpfile.babel.js +++ b/gulpfile.babel.js @@ -129,9 +129,6 @@ export function php() { .pipe( gulp.dest( paths.php.dest ) ); } - - - /** * Sass, if that's being used. */ diff --git a/package.json b/package.json index 20287b9..686dff6 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,8 @@ "import-fresh": "^2.0.0", "postcss-cssnext": "^3.1.0", "postcss-partial-import": "^4.1.0", - "require-uncached": "^1.0.3" + "require-uncached": "^1.0.3", + "wp-dev-lib": "github:xwp/wp-dev-lib" }, "babel": { "presets": [ From d80ec0c4e0f3ad50feb337b2cfad2c3581f3ba6c Mon Sep 17 00:00:00 2001 From: David Cramer Date: Wed, 11 Apr 2018 11:30:39 +0200 Subject: [PATCH 09/22] remove build files --- .gitignore | 4 +- functions.php | 297 ------------------------------------------------- index.php | 66 ----------- screenshot.png | Bin 264 -> 0 bytes style.css | 19 ---- 5 files changed, 1 insertion(+), 385 deletions(-) delete mode 100644 functions.php delete mode 100644 index.php delete mode 100644 screenshot.png delete mode 100644 style.css diff --git a/.gitignore b/.gitignore index 198eedd..d458a51 100644 --- a/.gitignore +++ b/.gitignore @@ -7,16 +7,14 @@ !.babelrc !composer.json -composer.lock !.editorconfig !.eslintignore !.eslintrc.json !.gitignore !gulpfile.bable.js !LICENSE -package-lock.json !package.json -phpcs.xml.dist +!phpcs.xml.dist !README.md !screenshot.png !.travis.yml diff --git a/functions.php b/functions.php deleted file mode 100644 index 2e242d9..0000000 --- a/functions.php +++ /dev/null @@ -1,297 +0,0 @@ - tag in the document head, and expect WordPress to - * provide it for us. - */ - add_theme_support( 'title-tag' ); - - /** - * Enable support for Post Thumbnails on posts and pages. - * - * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/ - */ - add_theme_support( 'post-thumbnails' ); - - // This theme uses wp_nav_menu() in one location. - register_nav_menus( - array( - 'menu-1' => esc_html__( 'Primary', 'travel' ), - ) - ); - - /** - * Switch default core markup for search form, comment form, and comments - * to output valid HTML5. - */ - add_theme_support( - 'html5', array( - 'search-form', - 'comment-form', - 'comment-list', - 'gallery', - 'caption', - ) - ); - - // Set up the WordPress core custom background feature. - add_theme_support( - 'custom-background', apply_filters( - 'travel_custom_background_args', array( - 'default-color' => 'ffffff', - 'default-image' => '', - ) - ) - ); - - // Add theme support for selective refresh for widgets. - add_theme_support( 'customize-selective-refresh-widgets' ); - - /** - * Add support for core custom logo. - * - * @link https://codex.wordpress.org/Theme_Logo - */ - add_theme_support( - 'custom-logo', array( - 'height' => 250, - 'width' => 250, - 'flex-width' => true, - 'flex-height' => true, - ) - ); - - add_theme_support( - 'gutenberg', array( - 'wide-images' => true, - 'colors' => array( - '#0073aa', - '#229fd8', - '#eee', - '#444', - ), - ) - ); - - // Add custom theme supports. - add_theme_support( 'amp' ); - - // init custom post type. - new AMP_Travel_CPT(); - // init taxonomies. - new AMP_Travel_Taxonomies(); - - } -endif; -add_action( 'after_setup_theme', 'travel_setup' ); - -/** - * Set the content width in pixels, based on the theme's design and stylesheet. - * - * Priority 0 to make it available to lower priority callbacks. - * - * @global int $content_width - */ -function travel_content_width() { - - if ( isset( $GLOBALS['content_width'] ) ) { - $content_width = $GLOBALS['content_width']; - } - - // Check if the sidebar is in use. - if ( is_active_sidebar( 'sidebar-1' ) ) { - $content_width = 864; - } else { - $content_width = 864; - } - - /** - * Filter content width of the theme. - * - * @param int $content_width Content width in pixels. - */ - $GLOBALS['content_width'] = apply_filters( 'travel_content_width', $content_width ); -} -add_action( 'template_redirect', 'travel_content_width', 0 ); - -/** - * Register Google Fonts - */ -function travel_fonts_url() { - $fonts_url = ''; - - /** - * Translator: If Roboto Sans does not support characters in your language, translate this to 'off'. - */ - $lora = esc_html_x( 'on', 'Roboto Sans font: on or off', 'travel' ); - /** - * Translator: If Crimson Text does not support characters in your language, translate this to 'off'. - */ - $raleway = esc_html_x( 'on', 'Crimson Text font: on or off', 'travel' ); - - $font_families = array(); - - if ( 'off' !== $lora ) { - $font_families[] = 'Roboto Condensed:300,300i,400,400i'; - } - - if ( 'off' !== $raleway ) { - $font_families[] = 'Crimson Text:400,400i,600,600i'; - } - - if ( in_array( 'on', array( $lora, $raleway ) ) ) { - $query_args = array( - 'family' => urlencode( implode( '|', $font_families ) ), - 'subset' => urlencode( 'latin,latin-ext' ), - ); - - $fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' ); - } - - return esc_url_raw( $fonts_url ); - -} - -/** - * Add preconnect for Google Fonts. - * - * @since Twenty Seventeen 1.0 - * - * @param array $urls URLs to print for resource hints. - * @param string $relation_type The relation type the URLs are printed. - * @return array $urls URLs to print for resource hints. - */ -function travel_resource_hints( $urls, $relation_type ) { - if ( wp_style_is( 'travel-fonts', 'queue' ) && 'preconnect' === $relation_type ) { - $urls[] = array( - 'href' => 'https://fonts.gstatic.com', - 'crossorigin', - ); - } - - return $urls; -} -add_filter( 'wp_resource_hints', 'travel_resource_hints', 10, 2 ); - -/** - * Register widget area. - * - * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar - */ -function travel_widgets_init() { - register_sidebar( array( - 'name' => esc_html__( 'Sidebar', 'travel' ), - 'id' => 'sidebar-1', - 'description' => esc_html__( 'Add widgets here.', 'travel' ), - 'before_widget' => '
', - 'after_widget' => '
', - 'before_title' => '

', - 'after_title' => '

', - ) ); -} -add_action( 'widgets_init', 'travel_widgets_init' ); - -/** - * Enqueue styles. - */ -function travel_styles() { - // Add custom fonts, used in the main stylesheet. - wp_enqueue_style( 'travel-fonts', travel_fonts_url(), array(), null ); - - // Enqueue main stylesheet. - wp_enqueue_style( 'travelbase-style', get_stylesheet_uri(), array(), '20151215' ); - - // Register component styles that are printed as needed. - wp_register_style( 'travel-comments', get_theme_file_uri() . '/css/comments.css', array(), '20151215' ); - wp_register_style( 'travel-content', get_theme_file_uri() . '/css/content.css', array(), '20151215' ); - wp_register_style( 'travel-sidebar', get_theme_file_uri() . '/css/sidebar.css', array(), '20151215' ); - wp_register_style( 'travel-widgets', get_theme_file_uri() . '/css/widgets.css', array(), '20151215' ); - wp_register_style( 'travel-front-page', get_theme_file_uri() . '/css/front-page.css', array(), '20151215' ); -} -add_action( 'wp_enqueue_scripts', 'travel_styles' ); - -/** - * Enqueue scripts. - */ -function travel_scripts() { - - if ( ! travel_is_amp() ) { - wp_enqueue_script( 'travel-navigation', get_theme_file_uri() . '/js/navigation.js', array(), '20151215', false ); - wp_script_add_data( 'travel-navigation', 'async', true ); - - wp_enqueue_script( 'travel-skip-link-focus-fix', get_theme_file_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', false ); - wp_script_add_data( 'travel-skip-link-focus-fix', 'defer', true ); - - if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { - wp_enqueue_script( 'comment-reply' ); - } - } - -} -add_action( 'wp_enqueue_scripts', 'travel_scripts' ); - -/** - * Bring in Custom Post Type. - */ -require_once get_template_directory() . '/inc/classes/class-amp-travel-cpt.php'; - -/** - * Bring in Taxonomies. - */ -require_once get_template_directory() . '/inc/classes/class-amp-travel-taxonomies.php'; - -/** - * Implement the Custom Header feature. - */ -require get_template_directory() . '/pluggable/custom-header.php'; - -/** - * Custom template tags for this theme. - */ -require get_template_directory() . '/inc/template-tags.php'; - -/** - * Functions which enhance the theme by hooking into WordPress. - */ -require get_template_directory() . '/inc/template-functions.php'; - -/** - * Customizer additions. - */ -require get_template_directory() . '/inc/customizer.php'; - -/** - * Load Jetpack compatibility file. - */ -if ( defined( 'JETPACK__VERSION' ) ) { - require get_template_directory() . '/inc/jetpack.php'; -} diff --git a/index.php b/index.php deleted file mode 100644 index 355dd66..0000000 --- a/index.php +++ /dev/null @@ -1,66 +0,0 @@ - - -
- - - -
- -4{J9JLcjF$egBxB}_rRkpW)6k|z{ zUoeBivm0qZ&Sp;+$B>F!Zw@vBISdU8{;m{X$pm7O2NJ$LZ~*H(@qepeNGRE0sjYol,li>ul{margin-bottom:0;margin-left:1.5em}dt{font-weight:700}dd{margin:0 1.5em 1.5em}img{display:block;height:auto;max-width:100%}figure{margin:.5em 0}table{margin:0 0 1.5em;width:100%}a{color:#0073aa}a:visited{color:#333}a:active,a:focus,a:hover{color:#00a0d2}a:focus{outline:thin dotted}a:active,a:hover{outline:0}button,input[type=button],input[type=reset],input[type=submit]{border:1px solid;border-color:#ccc #ccc #bbb;border-radius:3px;background:#e6e6e6;color:rgba(0,0,0,.8);font-size:12px;font-size:.75rem;line-height:1;padding:.6em 1em .4em}button:hover,input[type=button]:hover,input[type=reset]:hover,input[type=submit]:hover{border-color:#ccc #bbb #aaa}button:active,button:focus,input[type=button]:active,input[type=button]:focus,input[type=reset]:active,input[type=reset]:focus,input[type=submit]:active,input[type=submit]:focus{border-color:#aaa #bbb #bbb}input[type=color],input[type=date],input[type=datetime-local],input[type=datetime],input[type=email],input[type=month],input[type=number],input[type=password],input[type=range],input[type=search],input[type=tel],input[type=text],input[type=time],input[type=url],input[type=week],textarea{color:#666;border:1px solid #ccc;border-radius:3px;padding:3px}input[type=color]:focus,input[type=date]:focus,input[type=datetime-local]:focus,input[type=datetime]:focus,input[type=email]:focus,input[type=month]:focus,input[type=number]:focus,input[type=password]:focus,input[type=range]:focus,input[type=search]:focus,input[type=tel]:focus,input[type=text]:focus,input[type=time]:focus,input[type=url]:focus,input[type=week]:focus,textarea:focus{color:#111}select{border:1px solid #ccc}textarea{width:100%}.site-branding{text-align:center;margin:60px 0 1.75em}.site-title{margin:.4375em 1em 0;font-family:Roboto Condensed,sans-serif;font-size:38px;font-weight:700;line-height:1.2;color:#333332}.site-title a{text-decoration:none;color:inherit}.site-description{margin:.4375em 0 0;font-size:17px;font-weight:inherit;line-height:1.4;word-wrap:break-word;color:#929292}.main-navigation,.site-description{font-family:Roboto Condensed,sans-serif}.main-navigation{clear:both;display:block;margin:0 auto;padding:0 1em;max-width:720px;max-width:45rem}.main-navigation ul{display:none;list-style:none;margin:0;padding-left:0}.main-navigation ul ul{box-shadow:0 3px 3px rgba(0,0,0,.2);float:left;position:absolute;top:100%;left:-999em;z-index:1}.main-navigation ul ul ul{left:-999em;top:0}.main-navigation ul ul li.focus>ul,.main-navigation ul ul li:hover>ul{left:100%}.main-navigation ul ul a{width:200px}.main-navigation ul li.focus>ul,.main-navigation ul li:hover>ul{display:block;left:auto}.main-navigation li{position:relative}.main-navigation a{display:block;text-decoration:none}@media screen and (max-width:37.5em){.main-navigation.toggled ul,.menu-toggle{display:block;margin:0 auto}}@media screen and (min-width:37.5em){.menu-toggle{display:none}.main-navigation ul{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-wrap:wrap;flex-wrap:wrap}.main-navigation a{padding:0 .5em}}.site-main .comment-navigation,.site-main .post-navigation,.site-main .posts-navigation{border-bottom:1px solid #111;margin:0 auto 60px;max-width:720px;overflow:hidden;padding-bottom:60px}.nav-links{display:-ms-flexbox;display:flex}.comment-navigation .nav-previous,.post-navigation .nav-previous,.posts-navigation .nav-previous{width:50%;-ms-flex:1 0 50%;flex:1 0 50%}.comment-navigation .nav-next,.post-navigation .nav-next,.posts-navigation .nav-next{text-align:end;-ms-flex:1 0 50%;flex:1 0 50%}.post-navigation-sub span{color:#333;text-decoration:none;display:inline-block}.site-footer{margin:1em 0;opacity:.5}.infinite-scroll.neverending .site-footer,.infinite-scroll .posts-navigation{display:none}.infinity-end.neverending .site-footer{display:block} \ No newline at end of file From 30b4bf5957b6f0fabd028c4db7f08b949237d06c Mon Sep 17 00:00:00 2001 From: David Cramer Date: Wed, 11 Apr 2018 11:38:02 +0200 Subject: [PATCH 10/22] change package and domain in dev and remove replace task from gulpfile --- dev/404.php | 10 +-- dev/comments.php | 10 +-- dev/footer.php | 8 +-- dev/functions.php | 78 +++++++++++------------ dev/header.php | 12 ++-- dev/inc/customizer.php | 22 +++---- dev/inc/jetpack.php | 12 ++-- dev/inc/template-functions.php | 32 +++++----- dev/inc/template-tags.php | 56 ++++++++-------- dev/index.php | 6 +- dev/optional/archive.php | 6 +- dev/optional/attachment.php | 4 +- dev/optional/category.php | 6 +- dev/optional/custom-page-template.php | 4 +- dev/optional/custom-post-template.php | 4 +- dev/optional/front-page.php | 6 +- dev/optional/page.php | 4 +- dev/optional/search.php | 6 +- dev/optional/single.php | 4 +- dev/optional/singular.php | 4 +- dev/pluggable/custom-header.php | 18 +++--- dev/sidebar.php | 4 +- dev/style.css | 2 +- dev/template-parts/content-attachment.php | 12 ++-- dev/template-parts/content-none.php | 10 +-- dev/template-parts/content-page.php | 8 +-- dev/template-parts/content-search.php | 10 +-- dev/template-parts/content.php | 18 +++--- gulpfile.babel.js | 6 -- 29 files changed, 188 insertions(+), 194 deletions(-) diff --git a/dev/404.php b/dev/404.php index ad3c20b..f52cbf3 100644 --- a/dev/404.php +++ b/dev/404.php @@ -4,7 +4,7 @@ * * @link https://codex.wordpress.org/Creating_an_Error_404_Page * - * @package pstt + * @package WPAMPTheme */ get_header(); ?> @@ -13,11 +13,11 @@
-

+

-

+

    ' . sprintf( esc_html__( 'Try looking in the monthly archives. %1$s', 'pstt' ), convert_smilies( ':)' ) ) . '

    '; + $archive_content = '

    ' . sprintf( esc_html__( 'Try looking in the monthly archives. %1$s', 'travel' ), convert_smilies( ':)' ) ) . '

    '; the_widget( 'WP_Widget_Archives', 'dropdown=1', "after_title=$archive_content" ); the_widget( 'WP_Widget_Tag_Cloud' ); diff --git a/dev/comments.php b/dev/comments.php index 5c1bf5d..318306b 100644 --- a/dev/comments.php +++ b/dev/comments.php @@ -7,7 +7,7 @@ * * @link https://codex.wordpress.org/Template_Hierarchy * - * @package pstt + * @package WPAMPTheme */ /* @@ -20,7 +20,7 @@ } ?> - +
    ' . get_the_title() . '' ); } else { printf( // WPCS: XSS OK. /* translators: 1: comment count number, 2: title. */ - esc_html( _nx( '%1$s thought on “%2$s”', '%1$s thoughts on “%2$s”', $comment_count, 'comments title', 'pstt' ) ), + esc_html( _nx( '%1$s thought on “%2$s”', '%1$s thoughts on “%2$s”', $comment_count, 'comments title', 'travel' ) ), number_format_i18n( $comment_count ), '' . get_the_title() . '' ); @@ -66,7 +66,7 @@ // If comments are closed and there are comments, let's leave a little note, shall we? if ( ! comments_open() ) : ?> -

    +

    @@ -20,16 +20,16 @@
    - + | PSTT', 'the contributors' ); + printf( esc_html__( 'Theme: %1$s by %2$s.', 'travel' ), 'Travel', 'the contributors' ); ?>
    diff --git a/dev/functions.php b/dev/functions.php index 342347e..18174e8 100644 --- a/dev/functions.php +++ b/dev/functions.php @@ -1,13 +1,13 @@ esc_html__( 'Primary', 'pstt' ), + 'menu-1' => esc_html__( 'Primary', 'travel' ), ) ); @@ -66,7 +66,7 @@ function pstt_setup() { // Set up the WordPress core custom background feature. add_theme_support( 'custom-background', apply_filters( - 'pstt_custom_background_args', array( + 'travel_custom_background_args', array( 'default-color' => 'ffffff', 'default-image' => '', ) @@ -111,7 +111,7 @@ function pstt_setup() { } endif; -add_action( 'after_setup_theme', 'pstt_setup' ); +add_action( 'after_setup_theme', 'travel_setup' ); /** * Set the content width in pixels, based on the theme's design and stylesheet. @@ -120,7 +120,7 @@ function pstt_setup() { * * @global int $content_width */ -function pstt_content_width() { +function travel_content_width() { if ( isset( $GLOBALS['content_width'] ) ) { $content_width = $GLOBALS['content_width']; @@ -138,24 +138,24 @@ function pstt_content_width() { * * @param int $content_width Content width in pixels. */ - $GLOBALS['content_width'] = apply_filters( 'pstt_content_width', $content_width ); + $GLOBALS['content_width'] = apply_filters( 'travel_content_width', $content_width ); } -add_action( 'template_redirect', 'pstt_content_width', 0 ); +add_action( 'template_redirect', 'travel_content_width', 0 ); /** * Register Google Fonts */ -function pstt_fonts_url() { +function travel_fonts_url() { $fonts_url = ''; /** * Translator: If Roboto Sans does not support characters in your language, translate this to 'off'. */ - $lora = esc_html_x( 'on', 'Roboto Sans font: on or off', 'pstt' ); + $lora = esc_html_x( 'on', 'Roboto Sans font: on or off', 'travel' ); /** * Translator: If Crimson Text does not support characters in your language, translate this to 'off'. */ - $raleway = esc_html_x( 'on', 'Crimson Text font: on or off', 'pstt' ); + $raleway = esc_html_x( 'on', 'Crimson Text font: on or off', 'travel' ); $font_families = array(); @@ -189,8 +189,8 @@ function pstt_fonts_url() { * @param string $relation_type The relation type the URLs are printed. * @return array $urls URLs to print for resource hints. */ -function pstt_resource_hints( $urls, $relation_type ) { - if ( wp_style_is( 'pstt-fonts', 'queue' ) && 'preconnect' === $relation_type ) { +function travel_resource_hints( $urls, $relation_type ) { + if ( wp_style_is( 'travel-fonts', 'queue' ) && 'preconnect' === $relation_type ) { $urls[] = array( 'href' => 'https://fonts.gstatic.com', 'crossorigin', @@ -199,56 +199,56 @@ function pstt_resource_hints( $urls, $relation_type ) { return $urls; } -add_filter( 'wp_resource_hints', 'pstt_resource_hints', 10, 2 ); +add_filter( 'wp_resource_hints', 'travel_resource_hints', 10, 2 ); /** * Register widget area. * * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar */ -function pstt_widgets_init() { +function travel_widgets_init() { register_sidebar( array( - 'name' => esc_html__( 'Sidebar', 'pstt' ), + 'name' => esc_html__( 'Sidebar', 'travel' ), 'id' => 'sidebar-1', - 'description' => esc_html__( 'Add widgets here.', 'pstt' ), + 'description' => esc_html__( 'Add widgets here.', 'travel' ), 'before_widget' => '
    ', 'after_widget' => '
    ', 'before_title' => '

    ', 'after_title' => '

    ', ) ); } -add_action( 'widgets_init', 'pstt_widgets_init' ); +add_action( 'widgets_init', 'travel_widgets_init' ); /** * Enqueue styles. */ -function pstt_styles() { +function travel_styles() { // Add custom fonts, used in the main stylesheet. - wp_enqueue_style( 'pstt-fonts', pstt_fonts_url(), array(), null ); + wp_enqueue_style( 'travel-fonts', travel_fonts_url(), array(), null ); // Enqueue main stylesheet. - wp_enqueue_style( 'psttbase-style', get_stylesheet_uri(), array(), '20151215' ); + wp_enqueue_style( 'travelbase-style', get_stylesheet_uri(), array(), '20151215' ); // Register component styles that are printed as needed. - wp_register_style( 'pstt-comments', get_theme_file_uri() . '/css/comments.css', array(), '20151215' ); - wp_register_style( 'pstt-content', get_theme_file_uri() . '/css/content.css', array(), '20151215' ); - wp_register_style( 'pstt-sidebar', get_theme_file_uri() . '/css/sidebar.css', array(), '20151215' ); - wp_register_style( 'pstt-widgets', get_theme_file_uri() . '/css/widgets.css', array(), '20151215' ); - wp_register_style( 'pstt-front-page', get_theme_file_uri() . '/css/front-page.css', array(), '20151215' ); + wp_register_style( 'travel-comments', get_theme_file_uri() . '/css/comments.css', array(), '20151215' ); + wp_register_style( 'travel-content', get_theme_file_uri() . '/css/content.css', array(), '20151215' ); + wp_register_style( 'travel-sidebar', get_theme_file_uri() . '/css/sidebar.css', array(), '20151215' ); + wp_register_style( 'travel-widgets', get_theme_file_uri() . '/css/widgets.css', array(), '20151215' ); + wp_register_style( 'travel-front-page', get_theme_file_uri() . '/css/front-page.css', array(), '20151215' ); } -add_action( 'wp_enqueue_scripts', 'pstt_styles' ); +add_action( 'wp_enqueue_scripts', 'travel_styles' ); /** * Enqueue scripts. */ -function pstt_scripts() { +function travel_scripts() { - if ( ! pstt_is_amp() ) { - wp_enqueue_script( 'pstt-navigation', get_theme_file_uri() . '/js/navigation.js', array(), '20151215', false ); - wp_script_add_data( 'pstt-navigation', 'async', true ); + if ( ! travel_is_amp() ) { + wp_enqueue_script( 'travel-navigation', get_theme_file_uri() . '/js/navigation.js', array(), '20151215', false ); + wp_script_add_data( 'travel-navigation', 'async', true ); - wp_enqueue_script( 'pstt-skip-link-focus-fix', get_theme_file_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', false ); - wp_script_add_data( 'pstt-skip-link-focus-fix', 'defer', true ); + wp_enqueue_script( 'travel-skip-link-focus-fix', get_theme_file_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', false ); + wp_script_add_data( 'travel-skip-link-focus-fix', 'defer', true ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); @@ -256,7 +256,7 @@ function pstt_scripts() { } } -add_action( 'wp_enqueue_scripts', 'pstt_scripts' ); +add_action( 'wp_enqueue_scripts', 'travel_scripts' ); /** * Bring in Custom Post Type. diff --git a/dev/header.php b/dev/header.php index 3931258..93efaab 100644 --- a/dev/header.php +++ b/dev/header.php @@ -6,7 +6,7 @@ * * @link https://developer.wordpress.org/themes/basics/template-files/#template-partials * - * @package pstt + * @package WPAMPTheme */ ?> @@ -22,7 +22,7 @@ >
    - + - +
    '