Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Theme Check requirements #27

Merged
merged 22 commits into from
Dec 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,10 @@ $RECYCLE.BIN/
composer.lock

# Production Assets
assets/scripts
assets/styles
/admin.js
/array-reverse-polyfill.js
/blocks.js
/bundle.js
/print.css
/style.css
/style-editor.css
Binary file removed assets/favicons/android-chrome-144x144.png
Binary file not shown.
Binary file removed assets/favicons/apple-touch-icon.png
Binary file not shown.
9 changes: 0 additions & 9 deletions assets/favicons/browserconfig.xml

This file was deleted.

Binary file removed assets/favicons/favicon-16x16.png
Binary file not shown.
Binary file removed assets/favicons/favicon-32x32.png
Binary file not shown.
Binary file removed assets/favicons/favicon.ico
Binary file not shown.
Binary file removed assets/favicons/mstile-150x150.png
Binary file not shown.
26 changes: 0 additions & 26 deletions assets/favicons/safari-pinned-tab.svg

This file was deleted.

14 changes: 0 additions & 14 deletions assets/favicons/site.webmanifest

This file was deleted.

67 changes: 67 additions & 0 deletions comments.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php

if ( post_password_required() ) {
return;
}
?>

<div id="comments" class="comments-area">
<?php if ( have_comments() ) : ?>
<h2 class="comments-title">
<?php

echo esc_html( sprintf(
/* translators: 1: number of comments, 2: post title */
_nx( '%1$s Reply to &ldquo;%2$s&rdquo;', '%1$s Replies to &ldquo;%2$s&rdquo;', get_comments_number(), 'comments title', 'benenson' ),
number_format_i18n( get_comments_number() ),
get_the_title()
) );

?>
</h2>

<ol class="comment-list">
<?php

wp_list_comments( [
'avatar_size' => 100,
'style' => 'ol',
'short_ping' => true,
'reply_text' => __( 'Reply', 'benenson' ),
] );

?>
</ol>

<?php

the_comments_pagination( [
'prev_text' => __( 'Previous', 'benenson' ),
'next_text' => __( 'Next', 'benenson' ),
] );

?>

<?php endif; ?>


<?php if ( ! comments_open() && get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) : ?>
<p class="no-comments"><?php echo esc_html( __( 'Comments are closed.', 'benenson' ) ); ?></p>
<?php endif; ?>

<?php

comment_form( [
'class_submit' => 'btn',
'comment_field' => implode( '', [
'<p class="comment-form-comment">',
'<label for="comment">',
_x( 'Comment', 'noun', 'benenson' ),
'</label><br>',
'<textarea id="comment" name="comment" cols="45" rows="8" maxlength="65525" required="required"></textarea>',
'</p>',
] ),
] );

?>
</div>
11 changes: 10 additions & 1 deletion front-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@

?>
<main id="main" role="main">
<?php the_content(); ?>
<?php

the_content();

wp_link_pages( [
'before' => sprintf( '<div class="page-links">%s', __( 'Pages:', 'benenson' ) ),
'after' => '</div>',
] );

?>
</main>
<?php get_footer(); ?>
3 changes: 1 addition & 2 deletions gulp/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Main dirs.
*/
const srcDir = 'src';
const distDir = 'assets';
const distDir = '.';

/**
* Globally accessible options.
Expand All @@ -14,7 +14,6 @@ const config = {
tasks: [
'browsersync',
'clean',
'favicons',
'images',
'static',
'styles',
Expand Down
18 changes: 10 additions & 8 deletions gulp/tasks/clean.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ const gulp = require('gulp');
const del = require('del');
const config = require('../config');

const paths = {
dev: `${config.dist}`,
production: [
`${config.dist}/scripts`,
`${config.dist}/styles`,
],
};
const paths = [
`${config.dist}/style.css`,
`${config.dist}/style-editor.css`,
`${config.dist}/print.css`,
`${config.dist}/admin.js`,
`${config.dist}/array-reverse-polyfill.js`,
`${config.dist}/blocks.js`,
`${config.dist}/bundle.js`,
];

module.exports = () => {
gulp.task('clean', () => del(config.ENV === 'dev' ? paths.dev : paths.production));
gulp.task('clean', () => del(paths));
};
28 changes: 0 additions & 28 deletions gulp/tasks/favicons.js

This file was deleted.

21 changes: 18 additions & 3 deletions gulp/tasks/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,18 @@ const browserSync = require('browser-sync').get('bigbite');
const transforms = require('../common/postcssTransforms');
const errorHandler = require('../utils/errorHandler');
const config = require('../config');
const postcssBanner = require('postcss-banner');

const paths = {
includePaths: Array.prototype.concat(require('node-normalize-scss').includePaths),
src: [
`${config.src}/styles/app.scss`,
`${config.src}/styles/gutenberg.scss`,
`${config.src}/styles/style.scss`,
`${config.src}/styles/style-editor.scss`,
],
lint: [
`./${config.src}/styles/**/*.scss`,
],
out: `${config.dist}/styles`,
out: `${config.dist}/`,
};

const lintTransforms = [
Expand All @@ -33,6 +34,20 @@ const lintTransforms = [
}),
];

transforms.push(postcssBanner({ banner: `
Theme Name: Benenson
Theme URI: https://benenson.co
Description: Benenson Theme
Version: 1.0.2
Author: Big Bite Creative
Author URI: https://bigbitecreative.com
Text Domain: benenson
Domain Path: /languages
License: GNU General Public License v3
License URI: LICENSE
Tags: theme-options, rtl-language-support, full-width-template, custom-menu, blog, education, news
` }));

module.exports = () => {
gulp.task('styles:lint', () => gulp.src(paths.lint)
.pipe(plumber({ errorHandler }))
Expand Down
11 changes: 1 addition & 10 deletions header.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,9 @@
<!DOCTYPE html>
<html class="no-js" <?php language_attributes(); ?>>
<head>
<meta charset="UTF-8">
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title><?php wp_title( '&bull;', true, 'right' ); ?> <?php echo esc_attr( get_bloginfo( 'name' ) ); ?></title>

<link rel="apple-touch-icon" sizes="180x180" href="<?php echo esc_url( sprintf( '%s/assets/favicons/apple-touch-icon.png', get_template_directory_uri() ) ); ?>">
<link rel="icon" type="image/png" sizes="32x32" href="<?php echo esc_url( sprintf( '%s/assets/favicons/favicon-32x32.png', get_template_directory_uri() ) ); ?>">
<link rel="icon" type="image/png" sizes="16x16" href="<?php echo esc_url( sprintf( '%s/assets/favicons/favicon-16x16.png', get_template_directory_uri() ) ); ?>">
<link rel="manifest" href="<?php echo esc_url( sprintf( '%s/assets/favicons/site.webmanifest', get_template_directory_uri() ) ); ?>">
<link rel="mask-icon" href="<?php echo esc_url( sprintf( '%s/assets/favicons/safari-pinned-tab.svg', get_template_directory_uri() ) ); ?>" color="#5bbad5">
<meta name="msapplication-TileColor" content="#ffc40d">
<meta name="theme-color" content="#ffffff">
<script>(function(h){h.classList.remove('no-js');h.classList.add('js');})(document.documentElement);</script>
<?php wp_head(); ?>
</head>
Expand Down
1 change: 0 additions & 1 deletion includes/blocks/menu/render.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ function benenson_render_menu_block( $atts = [] ) {

$menu = wp_get_nav_menu_object( absint( $menu_id ) );
$menu_count = $menu->count;
$key = base64_encode( $menu->name );

ob_start();
?>
Expand Down
11 changes: 11 additions & 0 deletions includes/meta.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,14 @@ function benenson_get_meta_field( $field, $post_id = false, $single = true ) {
return get_post_meta( $post_id, $field, $single );
}
}

/**
* Append Site Title to `<title>`.
*/
add_filter( 'wp_title', function ( $title = '' ) {
if ( false === apply_filters( 'benenson_append_blogname_to_wp_title', true ) ) {
return $title;
}

return sprintf( '%s %s', $title, esc_attr( get_bloginfo( 'name' ) ) );
} );
13 changes: 13 additions & 0 deletions includes/post-filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,3 +216,16 @@ function benenson_strip_empty_sections( $content = '' ) {
}

add_filter( 'the_content', 'benenson_strip_empty_sections', 20 );

/**
* Add a classname to post tag term links
*/
add_filter( 'term_links-post_tag', function ( $links = [] ) {
$tag_class = apply_filters( 'benenson_post_tag_classname', 'post-category' );

foreach ( $links as &$link ) {
$link = str_replace( '<a ', sprintf( '<a class="%s" ', $tag_class ), $link );
}

return $links;
} );
22 changes: 14 additions & 8 deletions includes/scripts-and-styles.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function array_reverse_polyfill() {
return;
}

wp_enqueue_script( 'benenson-array-reverse', benenson_asset_uri( 'scripts/array-reverse-polyfill.js' ), [], '1.0.0', false );
wp_enqueue_script( 'benenson-array-reverse', get_template_directory_uri() . '/array-reverse-polyfill.js', [], '1.0.2', false );
}

add_action( 'admin_enqueue_scripts', 'array_reverse_polyfill' );
Expand All @@ -50,13 +50,13 @@ function array_reverse_polyfill() {
*/
if ( ! function_exists( 'benenson_styles' ) ) {
function benenson_styles() {
wp_enqueue_style( 'global-styles', benenson_asset_uri( 'styles' ) . '/app.css', [], '1.0.0', 'all' );
wp_enqueue_style( 'global-styles', get_template_directory_uri() . '/style.css', [], '1.0.2', 'all' );

if ( is_singular( 'post' ) || ! is_page_template( 'templates/without-sidebar' ) ) {
wp_enqueue_style( 'print-styles', benenson_asset_uri( 'styles' ) . '/print.css', [], '1.0.0', 'print' );
wp_enqueue_style( 'print-styles', get_template_directory_uri() . '/print.css', [], '1.0.2', 'print' );
}

wp_enqueue_style( 'google-fonts', 'https://fonts.googleapis.com/css?family=Lato:300,400,700|Playfair+Display:400,600,700,700i,900,900i', [], '1.0.0' );
wp_enqueue_style( 'google-fonts', 'https://fonts.googleapis.com/css?family=Lato:300,400,700|Playfair+Display:400,600,700,700i,900,900i', [], '1.0.2' );
}
}

Expand All @@ -72,10 +72,14 @@ function benenson_styles() {
if ( ! function_exists( 'benenson_scripts' ) ) {
function benenson_scripts() {
if ( defined( 'ENABLE_LIVERELOAD' ) && ENABLE_LIVERELOAD ) {
wp_enqueue_script( 'livereload', 'https://livereload.bigbite.site:35729/livereload.js', [], '1.0.0', true );
wp_enqueue_script( 'livereload', 'https://livereload.bigbite.site:35729/livereload.js', [], '1.0.2', true );
}

wp_enqueue_script( 'global-scripts', benenson_asset_uri( 'scripts' ) . '/bundle.js', [], '1.0.0', true );
wp_enqueue_script( 'global-scripts', get_template_directory_uri() . '/bundle.js', [], '1.0.2', true );

if ( is_singular() && comments_open() && get_option( 'thread_comments' ) && true === apply_filters( 'benenson_comments_enabled', false ) ) {
wp_enqueue_script( 'comment-reply' );
}

if ( ! is_home() && ! is_archive() && ! is_search() ) {
return;
Expand All @@ -97,7 +101,7 @@ function benenson_scripts() {
*/
if ( ! function_exists( 'benenson_gutenberg_assets' ) ) {
function benenson_gutenberg_assets() {
wp_enqueue_script( 'benenson-blocks-js', benenson_asset_uri( 'scripts' ) . '/blocks.js', [
wp_enqueue_script( 'benenson-blocks-js', get_template_directory_uri() . '/blocks.js', [
'wp-blocks',
'wp-i18n',
'wp-element',
Expand All @@ -106,16 +110,18 @@ function benenson_gutenberg_assets() {
], true, false );

if ( function_exists( 'gutenberg_get_jed_locale_data' ) ) {
// gutenberg plugin
wp_add_inline_script(
'benenson-blocks-js',
sprintf( "wp.i18n.setLocaleData(%s, 'benenson')", wp_json_encode( gutenberg_get_jed_locale_data( 'benenson' ) ) ),
'before'
);
} elseif ( function_exists( 'wp_set_script_translations' ) ) {
// wp v5
wp_set_script_translations( 'benenson-blocks-js', 'benenson' );
}

wp_enqueue_style( 'benenson-gutenberg', benenson_asset_uri( 'styles' ) . '/gutenberg.css', [ 'wp-block-library-theme' ], '1', 'all' );
add_editor_style( 'style-editor.css' );
}
}

Expand Down
Loading