Comment out example "add_image_size" as it can be easily forgotten
which leaves you with extra unused image size, Add CHANGELOG.MD to
track changes, Tidy up formatting using PHP-CS-Fixer (mostly spacing),
Update README.MD dependencies
This commit is contained in:
Lukas Juhas 2016-08-09 13:22:26 +01:00
parent 585aa37d39
commit 6b6864f7a0
10 changed files with 76 additions and 64 deletions

12
CHANGELOG.md Normal file
View File

@ -0,0 +1,12 @@
# barebones changelog
## 2.0.1
* Comment out example "add_image_size" as it can be easily forgotten which leaves you with extra unused image size.
* Add CHANGELOG.MD to track changes
* Tidy up formatting using PHP-CS-Fixer (mostly spacing)
* Update README.MD dependencies
## 2.0.0
* Refreshed tooling using Elixir with lots of improvements

View File

@ -33,6 +33,8 @@ To include all its optional submodules ([Simple Grid](https://github.com/benchma
* [Node.js](http://nodejs.org)
* [Gulp](http://gulpjs.com)
* [Gulp Imagemin](https://github.com/sindresorhus/gulp-imagemin)
* [Laravel Elixir](https://github.com/laravel/elixir)
### Using Gulp and Laravel Elixir
@ -52,11 +54,11 @@ Then run:
*to compile*
gulp watch
gulp watch
*to watch*
gulp --production
gulp --production
*to minify*

View File

@ -1,7 +1,7 @@
<footer class="footer" role="contentinfo">
<div class="container">
<?php wp_nav_menu(['theme_location' => 'footer', 'menu_class' => 'nav nav--footer']); ?>
&copy; <?php bloginfo( 'name' ); ?> <?php echo date( 'Y' ); ?>
&copy; <?php bloginfo('name'); ?> <?php echo date('Y'); ?>
</div>
</footer>
<?php wp_footer(); ?>

View File

@ -12,21 +12,20 @@ require_once 'functions/example.php';
* Add support for useful stuff
*/
if ( function_exists( 'add_theme_support' ) )
{
if (function_exists('add_theme_support')) {
// Add support for document title tag
add_theme_support( 'title-tag' );
add_theme_support('title-tag');
// Add Thumbnail Theme Support
add_theme_support( 'post-thumbnails' );
add_image_size( 'custom-size', 700, 200, true );
add_theme_support('post-thumbnails');
// add_image_size( 'custom-size', 700, 200, true );
// Add Support for post formats
// add_theme_support( 'post-formats', ['post'] );
// add_post_type_support( 'page', 'excerpt' );
// Localisation Support
load_theme_textdomain( 'barebones', get_template_directory() . '/languages' );
load_theme_textdomain('barebones', get_template_directory() . '/languages');
}
@ -35,27 +34,27 @@ if ( function_exists( 'add_theme_support' ) )
* Remove junk
*/
define( 'ICL_DONT_LOAD_LANGUAGE_SELECTOR_CSS', true );
define( 'ICL_DONT_LOAD_LANGUAGES_JS', true );
define('ICL_DONT_LOAD_LANGUAGE_SELECTOR_CSS', true);
define('ICL_DONT_LOAD_LANGUAGES_JS', true);
add_filter('show_admin_bar', '__return_false');
remove_action( 'wp_head', 'rsd_link' );
remove_action( 'wp_head', 'wlwmanifest_link' );
remove_action( 'wp_head', 'wp_generator' );
remove_action( 'wp_head', 'start_post_rel_link' );
remove_action( 'wp_head', 'index_rel_link' );
remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head' );
remove_action( 'wp_head', 'wp_shortlink_wp_head', 10, 0 );
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
remove_action('wp_head', 'rsd_link');
remove_action('wp_head', 'wlwmanifest_link');
remove_action('wp_head', 'wp_generator');
remove_action('wp_head', 'start_post_rel_link');
remove_action('wp_head', 'index_rel_link');
remove_action('wp_head', 'adjacent_posts_rel_link_wp_head');
remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0);
remove_action('wp_head', 'print_emoji_detection_script', 7);
remove_action('wp_print_styles', 'print_emoji_styles');
function barebones_remove_comments_rss( $for_comments )
function barebones_remove_comments_rss($for_comments)
{
return;
}
add_filter( 'post_comments_feed_link', 'barebones_remove_comments_rss' );
add_filter('post_comments_feed_link', 'barebones_remove_comments_rss');
@ -70,13 +69,13 @@ function barebones_scripts()
*/
// wp_enqueue_style( 'fonts', '//fonts.googleapis.com/css?family=Font+Family' );
// wp_enqueue_style( 'icons', '//maxcdn.bootstrapcdn.com/font-awesome/4.6.0/css/font-awesome.min.css' );
wp_deregister_script( 'jquery' );
wp_register_script( 'jquery', '//ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js', false, '1.11.3', true );
wp_enqueue_script( 'jquery' );
wp_enqueue_script( 'script', get_stylesheet_directory_uri() . '/js/script.min.js?' . time(), ['jquery'], null, true );
wp_deregister_script('jquery');
wp_register_script('jquery', '//ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js', false, '1.11.3', true);
wp_enqueue_script('jquery');
wp_enqueue_script('script', get_stylesheet_directory_uri() . '/js/script.min.js?' . time(), ['jquery'], null, true);
}
add_action( 'wp_enqueue_scripts', 'barebones_scripts' );
add_action('wp_enqueue_scripts', 'barebones_scripts');
@ -84,15 +83,14 @@ add_action( 'wp_enqueue_scripts', 'barebones_scripts' );
* Nav menus
*/
if ( function_exists( 'register_nav_menus' ) )
{
if (function_exists('register_nav_menus')) {
register_nav_menus([
'header' => 'Header',
'footer' => 'Footer'
]);
}
function barebones_nav_menu_args( $args = '' )
function barebones_nav_menu_args($args = '')
{
$args['container'] = false;
$args['container_class'] = false;
@ -102,7 +100,7 @@ function barebones_nav_menu_args( $args = '' )
return $args;
}
add_filter( 'wp_nav_menu_args', 'barebones_nav_menu_args' );
add_filter('wp_nav_menu_args', 'barebones_nav_menu_args');
@ -110,20 +108,20 @@ add_filter( 'wp_nav_menu_args', 'barebones_nav_menu_args' );
* Email
*/
function barebones_mail_from( $email )
function barebones_mail_from($email)
{
return get_option( 'admin_email' );
return get_option('admin_email');
}
add_filter( 'wp_mail_from', 'barebones_mail_from' );
add_filter('wp_mail_from', 'barebones_mail_from');
function barebones_mail_from_name( $name )
function barebones_mail_from_name($name)
{
return get_bloginfo( 'name' );
return get_bloginfo('name');
}
add_filter( 'wp_mail_from_name', 'barebones_mail_from_name' );
add_filter('wp_mail_from_name', 'barebones_mail_from_name');
@ -131,14 +129,14 @@ add_filter( 'wp_mail_from_name', 'barebones_mail_from_name' );
* Shortcodes ([button] shortcode included)
*/
function button_shortcode( $atts, $content = null )
function button_shortcode($atts, $content = null)
{
$atts['class'] = isset($atts['class']) ? $atts['class'] : 'btn';
return '<a class="' . $atts['class'] . '" href="' . $atts['link'] . '">' . $content . '</a>';
}
add_shortcode( 'button', 'button_shortcode' );
add_shortcode('button', 'button_shortcode');
@ -146,18 +144,18 @@ add_shortcode( 'button', 'button_shortcode' );
* TinyMCE
*/
function barebones_mce_buttons_2( $buttons )
function barebones_mce_buttons_2($buttons)
{
array_unshift( $buttons, 'styleselect' );
array_unshift($buttons, 'styleselect');
$buttons[] = 'hr';
return $buttons;
}
add_filter( 'mce_buttons_2', 'barebones_mce_buttons_2' );
add_filter('mce_buttons_2', 'barebones_mce_buttons_2');
function barebones_tiny_mce_before_init( $settings )
function barebones_tiny_mce_before_init($settings)
{
$style_formats = [
// [
@ -167,24 +165,24 @@ function barebones_tiny_mce_before_init( $settings )
// ]
];
$settings['style_formats'] = json_encode( $style_formats );
$settings['style_formats'] = json_encode($style_formats);
$settings['style_formats_merge'] = true;
return $settings;
}
add_filter( 'tiny_mce_before_init', 'barebones_tiny_mce_before_init' );
add_filter('tiny_mce_before_init', 'barebones_tiny_mce_before_init');
/**
* Get post thumbnail url
*
*
* @param int $post_id
* @return string
*/
function get_post_thumbnail_url( $post_id )
function get_post_thumbnail_url($post_id)
{
return wp_get_attachment_url( get_post_thumbnail_id( $post_id ) );
return wp_get_attachment_url(get_post_thumbnail_id($post_id));
}

View File

@ -3,11 +3,11 @@
<!--[if lte IE 9]><html <?php language_attributes(); ?> class="ie9"><![endif]-->
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta charset="<?php bloginfo('charset'); ?>">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0">
<link rel="dns-prefetch" href="//google-analytics.com">
<link rel="stylesheet" href="<?php echo get_bloginfo( 'stylesheet_url' ) . '?' . time(); ?>">
<link rel="stylesheet" href="<?php echo get_bloginfo('stylesheet_url') . '?' . time(); ?>">
<?php wp_head(); ?>
<!--[if lt IE 10]>
<script src="//cdnjs.cloudflare.com/ajax/libs/placeholders/3.0.2/placeholders.min.js"></script>

View File

@ -3,17 +3,17 @@
<main class="main" role="main">
<div class="container">
<?php while ( have_posts() ) : the_post(); ?>
<?php while (have_posts()) : the_post(); ?>
<article <?php post_class(); ?>>
<header class="post__header" role="heading">
<h3 class="post__title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<p class="post__date"><time><?php echo human_time_diff( strtotime( $post->post_date ) ) . ' ' . __( 'ago' ); ?></time></p>
<p class="post__comments"><?php comments_popup_link( __( 'No comments yet' ), __( '1 comment' ), __( '% comments' ) ); ?></p>
<p class="post__date"><time><?php echo human_time_diff(strtotime($post->post_date)) . ' ' . __('ago'); ?></time></p>
<p class="post__comments"><?php comments_popup_link(__('No comments yet'), __('1 comment'), __('% comments')); ?></p>
</header>
<?php the_content( __( 'Read More' ) ); ?>
<?php the_content(__('Read More')); ?>
</article>
@ -22,4 +22,4 @@
</div>
</main>
<?php get_footer(); ?>
<?php get_footer(); ?>

View File

@ -1,6 +1,6 @@
{
"name": "barebones",
"version": "2.0.0",
"version": "2.0.1",
"author": "Benchmark Studios",
"description": "A lightweight and skeletal WordPress boilerplate theme for HTML5 and beyond",
"license": "MIT",

View File

@ -3,7 +3,7 @@
<main class="main" role="main">
<div class="container">
<?php while ( have_posts() ) : the_post(); ?>
<?php while (have_posts()) : the_post(); ?>
<article <?php post_class(); ?>>

View File

@ -3,7 +3,7 @@
<main class="main" role="main">
<div class="container">
<?php while ( have_posts() ) : the_post(); ?>
<?php while (have_posts()) : the_post(); ?>
<article <?php post_class(); ?>>
@ -14,8 +14,8 @@
<?php the_content(); ?>
<footer class="post__footer">
<p class="post__date"><time><?php echo human_time_diff( strtotime( $post->post_date ) ) . ' ' . __( 'ago' ); ?></time></p>
<p class="post__comments"><?php comments_popup_link( __( 'No comments yet' ), __( '1 comment' ), __( '% comments' ) ); ?></p>
<p class="post__date"><time><?php echo human_time_diff(strtotime($post->post_date)) . ' ' . __('ago'); ?></time></p>
<p class="post__comments"><?php comments_popup_link(__('No comments yet'), __('1 comment'), __('% comments')); ?></p>
</footer>
</article>
@ -25,4 +25,4 @@
</div>
</main>
<?php get_footer(); ?>
<?php get_footer(); ?>

View File

@ -4,14 +4,14 @@
* Template Name: Demo page template
*/
get_header();
get_header();
?>
<main class="main" role="main">
<div class="container">
<?php while ( have_posts() ) : the_post(); ?>
<?php while (have_posts()) : the_post(); ?>
<article <?php post_class(); ?>>
@ -28,4 +28,4 @@
</div>
</main>
<?php get_footer(); ?>
<?php get_footer(); ?>