GithubHelp home page GithubHelp logo

keel's Introduction

[DEPRECATED] Keel Build Status

A lightweight boilerplate for WordPress theme developers.

Note: This project is no longer maintained.

How to Contribute

Please review the contributing guidelines.

License

The code is available under the MIT License.

keel's People

Contributors

cferdinandi avatar adsoncicilioti avatar

Stargazers

Samar avatar Naeem Noor avatar Naeem avatar Denis Yevtushenko avatar Kietil avatar Robert Pop avatar Chance Smith avatar Baki Goxhaj avatar Curtis Morte avatar Rogerio Marques avatar Paweł Derehajło avatar Bob Moore avatar Jay Fraser avatar Crystal avatar Tony Mosley avatar David Kirby avatar Gerson Niño Díaz avatar COMMWORK avatar  avatar  avatar Sam avatar hiro.hito avatar owen avatar Danny avatar  avatar Raí Siqueira avatar Max avatar Joe Yabuki avatar Nick LaDart avatar Cee Chen avatar Mohamed Abd Elhalim avatar Chris Canterbury avatar  avatar toppu avatar Robert Carroll avatar Zazi avatar Jonathan T L Lee avatar Samer avatar Eddie Ebeling avatar Mirado ZK avatar  avatar moritz avatar None avatar Chris Bracco avatar Pat avatar

Watchers

Michelle B avatar Baki Goxhaj avatar Mikhaël Aubut avatar  avatar Denis Yevtushenko avatar COMMWORK avatar  avatar

keel's Issues

Add Feedburner redirect to functions.php

    /**
     * Replace RSS links with Feedburner url
     * @link http://codex.wordpress.org/Using_FeedBurner
     */
    function keel_custom_rss_feed( $output, $feed ) {
        if ( strpos( $output, 'comments' ) ) {
            return $output;
        }
        return esc_url( 'http://feeds.feedburner.com/GoMakeThings' );
    }
    add_action( 'feed_link', 'keel_custom_rss_feed', 10, 2 );

Add additional map embedding support

fluidvids.init({
    selector: ['iframe', 'object'],
    players: ['www.youtube.com', 'player.vimeo.com', 'www.slideshare.net', 'www.google.com/maps', 'maps.google.com']
});

Add source file docs

3. [Working with the Source Files](#working-with-the-source-files)
## Working with the Source Files

If you would prefer, you can work with the development code in the `src` directory using the included [Gulp build system](http://gulpjs.com/). This compiles, lints, and minifies code, and runs unit tests.

### Dependencies
Make sure these are installed first.

* [Node.js](http://nodejs.org)
* [Ruby Sass](http://sass-lang.com/install)
* [Gulp](http://gulpjs.com) `sudo npm install -g gulp`
* [PhantomJS](http://phantomjs.org)

### Quick Start

1. In bash/terminal/command line, `cd` into your project directory.
2. Run `npm install` to install required files.
3. When it's done installing, run `gulp` to get going.

Every time you want to run your tasks, run `gulp`.

Add function to remove post limit

/**
 * Display all posts instead of a limited number
 * @param  array $query The WordPress post query
 */
// function keel_get_all_posts( $query ) {
//  $query->set( 'posts_per_page', '-1' );
// }
// add_action( 'pre_get_posts', 'keel_get_all_posts' );

Improve SVG detection

;(function (window, document, undefined) {

    'use strict';

    // SVG feature detection
    var supports = !!document.createElementNS && !!document.createElementNS('http://www.w3.org/2000/svg', 'svg').createSVGRect;

    // Check against Opera Mini (throws a false positive)
    var whitelist = navigator.userAgent.indexOf('Opera Mini') === -1;

    // If SVG is supported, add `.svg` class to <html> element
    if ( supports && whitelist ) {
        document.documentElement.className += (document.documentElement.className ? ' ' : '') + 'svg';
    }


})(window, document);

Add console log helper

/**
 * Log PHP in the JavaScript console
 */
function keel_console_log($name, $data = NULL, $jsEval = FALSE) {

    if (! $name) return false;

    $isevaled = false;
    $type = ( $data || gettype($data) ) ? 'Type: ' . gettype($data) : '';

    if ( $jsEval && ( is_array( $data ) || is_object( $data ) ) ) {
        $data = 'eval(' . preg_replace('#[\s\r\n\t\0\x0B]+#', '', json_encode($data)) . ')';
        $isevaled = true;
    } else {
        $data = json_encode($data);
    }

    // Sanitalize
    $data = $data ? $data : '';
    $search_array = array("#'#", '#""#', "#''#", "#\n#", "#\r\n#");
    $replace_array = array('"', '', '', '\\n', '\\n');
    $data = preg_replace($search_array,  $replace_array, $data);
    $data = ltrim(rtrim($data, '"'), '"');
    $data = $isevaled ? $data : ($data[0] === "'") ? $data : "'" . $data . "'";

    $js =
        "<script>
            // fallback - to deal with IE (or browsers that don't have console)
            if (! window.console) console = {};
            console.log = console.log || function(name, data){};
            // end of fallback

            console.log('$name');
            console.log('------------------------------------------');
            console.log('$type');
            console.log($data);
            console.log('\\n');
        </script>";

        echo $js;
}

Add feature detection init to functions.php

/**
 * Include feature detect inits in the header
 */
function keel_initialize_theme_detects() {
    ?>
        <script>
            // inits go here
        </script>
    <?php
}
add_action('wp_header', 'keel_initialize_theme_detects', 30);

Convert to lazypipe

"lazypipe": "0.2.2",
// Gulp Packages
var gulp = require('gulp');
var plumber = require('gulp-plumber');
var clean = require('gulp-clean');
var lazypipe = require('lazypipe');
var rename = require('gulp-rename');
var flatten = require('gulp-flatten');
var tap = require('gulp-tap');
var header = require('gulp-header');
var jshint = require('gulp-jshint');
var stylish = require('jshint-stylish');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var sass = require('gulp-ruby-sass');
var prefix = require('gulp-autoprefixer');
var minify = require('gulp-minify-css');
var karma = require('gulp-karma');
var package = require('./package.json');

// Paths to project folders
var paths = {
    output : 'dist/',
    scripts : {
        input : [ 'src/js/*' ],
        output : 'dist/js/'
    },
    styles : {
        input : 'src/sass/**/*.scss',
        output : 'dist/css/'
    },
    static : 'src/static/**',
    test : {
        spec : [ 'test/spec/**/*.js' ],
        coverage: 'test/coverage/',
        results: 'test/results/'
    }
};

// Template for banner to add to file headers
var banner = {
    full :
        '/**\n' +
        ' * <%= package.name %> v<%= package.version %>\n' +
        ' * <%= package.description %>, by <%= package.author.name %>.\n' +
        ' * <%= package.repository.url %>\n' +
        ' * \n' +
        ' * Free to use under the MIT License.\n' +
        ' * http://gomakethings.com/mit/\n' +
        ' */\n\n',
    min :
        '/**' +
        ' <%= package.name %> v<%= package.version %>, by Chris Ferdinandi' +
        ' | <%= package.repository.url %>' +
        ' | Licensed under MIT: http://gomakethings.com/mit/' +
        ' */\n'
};

// Lint, minify, and concatenate scripts
gulp.task('scripts', ['clean'], function() {

    var jsTasks = lazypipe()
        .pipe(header, banner.full, { package : package })
        .pipe(gulp.dest, paths.scripts.output)
        .pipe(rename, { suffix: '.min' })
        .pipe(uglify)
        .pipe(header, banner.min, { package : package })
        .pipe(gulp.dest, paths.scripts.output);

    return gulp.src(paths.scripts.input)
        .pipe(plumber())
        .pipe(flatten())
        .pipe(tap(function (file, t) {
            if ( file.stat.isDirectory() ) {
                var name = file.relative + '.js';
                return gulp.src(file.path + '/*.js')
                    .pipe(concat(name))
                    .pipe(jsTasks());
            }
        }))
        .pipe(jsTasks());
});

// Process, lint, and minify Sass files
gulp.task('styles', ['clean'], function() {
    return gulp.src(paths.styles.input)
        .pipe(plumber())
        .pipe(sass({style: 'expanded', noCache: true}))
        .pipe(flatten())
        .pipe(prefix('last 2 version', '> 1%'))
        .pipe(header(banner.full, { package : package }))
        .pipe(gulp.dest(paths.styles.output))
        .pipe(rename({ suffix: '.min' }))
        .pipe(minify())
        .pipe(header(banner.min, { package : package }))
        .pipe(gulp.dest(paths.styles.output));
});

// Copy static files into output folder
gulp.task('static', ['clean'], function() {
    return gulp.src(paths.static)
        .pipe(plumber())
        .pipe(gulp.dest(paths.output));
});

// Lint scripts
gulp.task('lint', function () {
    return gulp.src(paths.scripts.input)
        .pipe(plumber())
        .pipe(jshint())
        .pipe(jshint.reporter('jshint-stylish'));
});

// Remove prexisting content from output and test folders
gulp.task('clean', function () {
    return gulp.src([
            paths.output,
            paths.test.coverage,
            paths.test.results
        ], { read: false })
        .pipe(plumber())
        .pipe(clean());
});

// Run unit tests
gulp.task('test', function() {
    return gulp.src([paths.scripts.input + '/../**/*.js'].concat(paths.test.spec))
        .pipe(plumber())
        .pipe(karma({ configFile: 'test/karma.conf.js' }))
        .on('error', function(err) { throw err; });
});

// Combine tasks into runner
gulp.task('default', [
    'lint',
    'clean',
    'static',
    'scripts',
    'styles',
    'test'
]);

Clean up heading structure

See cferdinandi/harbor-wp-theme#38

Follow proper rank structure since doc outline is not supported by any browsers. On blog index and archive pages...

  • Use h2 with .h1 class
  • Add hidden h1 for heading if needed
  • Switch to the_excerpt() instead of the_content()

Update syntax for image alignment

/**
 * Image alignment
 */

.aligncenter {
    display: block;
    text-align: center;
    margin-left: auto;
    margin-right: auto;
}

.alignleft {
    @extend .aligncenter;

    @media (min-width: $bp-small) {
        float: left;
        margin-right: calc-em(8px);
    }
}

.alignright {
    @extend .aligncenter;

    @media (min-width: $bp-small) {
        float: right;
        margin-left: calc-em(8px);
    }
}

.alignnone {
    @extend .aligncenter;

    @media (min-width: $bp-small) {
        margin-left: 0;
        margin-right: 0;
    }
}

Add method to remove wpautop in functions.php

/**
 * Disable WordPress auto-formatting on page-plain.php template
 */
function keel_remove_wpautop() {
    if ( is_page_template( 'page-plain.php' ) ) {
        remove_filter('the_content', 'wpautop');
    }
}
add_action( 'pre_get_posts', 'keel_remove_wpautop' );

Update readme

In lieu of a formal style guide, take care to maintain the existing coding style. Please apply fixes to both the development and production code. Don't forget to update the version number, and when applicable, the documentation.

theme options missing?

Hi Chris, Noticed that Theme Support menu appears in place of Theme Options menu (compared to harbor theme). Wondering, where do I set theme options?

theme-options-missing

Add a11y feedback link to custom nav-accessibility.php template

<?php

/**
 * nav-accessibility.php
 * Template for accessibility improvements to the navigation.
 */

?>

<div class="container container-large">

    <!-- Skip link for better a11y -->
    <a class="screen-reader screen-reader-focusable" href="#main"><?php _e( 'Skip to main content', 'keel' ); ?></a>

    <!-- a11y feedback -->
    <a class="screen-reader screen-reader-focusable" href="mailto:<?php echo antispambot( get_option( 'admin_email' ) ); ?>?subject=Accessibility%20Feedback"><?php _e( 'Accessibility Feedback', 'keel' ); ?></a>

</div>

Load all styles and scripts in functions.php

/**
 * Load theme scripts in the footer
 */
function keel_load_theme_files() {
    wp_enqueue_script( 'keel-theme-detects', get_template_directory_uri() . '/dist/js/detects.js', null, null, false );
    wp_enqueue_style( 'keel-theme-styles', get_template_directory_uri() . '/dist/css/main.css', null, null, 'all' );
    wp_enqueue_script( 'keel-theme-scripts', get_template_directory_uri() . '/dist/js/main.js', null, null, true );
}
add_action('wp_enqueue_scripts', 'keel_load_theme_files'

Add support for SVGs in the content editor

/**
 * Allow new content types in posts
 */
$allowedposttags['svg']['xmlns'] = true;
$allowedposttags['svg']['class'] = true;
$allowedposttags['svg']['id'] = true;
$allowedposttags['svg']['viewbox'] = true;
$allowedposttags['path']['d'] = true;

get_template_directory_uri() in keel_load_inline_header()

Hey, shouldn´t get_template_directory_uri() in the function keel_load_inline_header() (functions.php) be replaced with get_template_directory()?
Otherwise file_get_contents is making a http request ... i guess, not sure ;)

`

get( 'Version' ) . '.js' ); ?>
        </script>

`

Add function to remove empty paragraphs added by wpautop

/**
 * Remove empty paragraphs created by wpautop()
 * @author Ryan Hamilton
 * @link https://gist.github.com/Fantikerz/5557617
 */
function keel_remove_empty_p( $content ) {
    $content = force_balance_tags( $content );
    $content = preg_replace( '#<p>\s*+(<br\s*/*>)?\s*</p>#i', '', $content );
    $content = preg_replace( '~\s?<p>(\s|&nbsp;)+</p>\s?~', '', $content );
    return $content;
}
add_filter('the_content', 'keel_remove_empty_p', 20, 1);

keel & kraken

For less experienced git & gulp users like me: what is the recommended way to start a new project with keel, kraken and astro?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.