Skip to content

Instantly share code, notes, and snippets.

@kevinwhoffman
kevinwhoffman / resources-web-developers-designers.md
Last active August 1, 2024 06:59
Resources for Web Developers and Designers

Resources for Web Developers and Designers

This is an incomplete list of resources including courses and individuals who publish content that has helped me grow as a web developer and designer. Many of these resources are WordPress-specific as that is my current area of specialization. This list will grow over time. If you've got something to add, send me a link @kevinwhoffman and I'll check it out!

Course Providers

/*global module:false*/
/*global require:false*/
/*jshint -W097*/
"use strict";
module.exports = function(grunt) {
// load all grunt tasks
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
@dtbaker
dtbaker / query.php
Last active August 29, 2015 14:09
Hacky caching with PHP
$key = $_SERVER['REMOTE_ADDR'] . serialize($_REQUEST);
if(strlen($key) < 500){ // help prevent flooding.
$key = md5($key);
// global so we can find it in the shutdown function
$GLOBALS['wordpress_temp_file'] = dirname(__FILE__).'/cache/wp_'.basename($key);
if(is_file($GLOBALS['wordpress_temp_file']) && filemtime($GLOBALS['wordpress_temp_file']) > (time() - 3600)){
$data = unserialize(file_get_contents($GLOBALS['wordpress_temp_file']));
echo $data['content'];
exit;
}
@chriscoyier
chriscoyier / frontendplugins.md
Last active March 3, 2021 17:31
How WordPress Plugins Should Handle Front End Resources

How WordPress Plugins Should Handle Front End Resources

This is a WORK IN PROGRESS intended for fleshing out and feedback

It's very common for people to be unhappy with how a WordPress plugin adds front end resources to their site. If a plugin needs CSS, the plugin will add a <link> element to that CSS. If the plugin needs JavaScript, it will add a <script> to that JavaScript.

Plugins do this because it works. It's damn important for a WordPress plugin to work, even in adverse conditions. They rightfully want good ratings and little customer support.

But this comes at the cost of additional HTTP requests. In optimizing front end performance of a site, reducing the number of HTTP requests is a huge thing. Front end developers want to decide and control how front end resources are being handled, and WordPress plugins don't typically make this easy on them.

@davatron5000
davatron5000 / Sublime Text Setup.md
Last active April 15, 2023 15:39
A new user's guide to SublimeText 2. Estimated reading time: 2 mins. Estimated workthrough time: 12 minutes.

Make it useful

  • Install Package Control. For SublimeText 2, paste the following in Terminal:
import urllib2,os; pf='Package Control.sublime-package'; ipp = sublime.installed_packages_path(); os.makedirs( ipp ) if not os.path.exists(ipp) else None; urllib2.install_opener( urllib2.build_opener( urllib2.ProxyHandler( ))); open( os.path.join( ipp, pf), 'wb' ).write( urllib2.urlopen( 'http://sublime.wbond.net/' +pf.replace( ' ','%20' )).read()); print( 'Please restart Sublime Text to finish installation')

From here on out, use Package Control to install everything. +Shift+P, then type Install to get a list of installable packages you can 'livesearch through. After installing plugins, they should be running.

@sevenspark
sevenspark / functions.php
Created August 8, 2013 16:23
UberMenu Post Grid Shortcode & Styling
<?php
/** ADD EVERYTHING BELOW THIS LINE TO YOUR CHILD THEME'S FUNCTIONS.PHP **/
function ubermenu_post_grid( $atts ){
//we're going to need access to the UberMenu object for image functionality
global $uberMenu;
@Japh
Japh / qa_wptsr.md
Last active May 14, 2017 11:41
Q & A on WordPress Theme Submission Requirements
@bitfade
bitfade / gist:4555047
Last active January 21, 2022 03:06
WordPress - Remove empty p tags for custom shortcodes
<?php
add_filter("the_content", "the_content_filter");
function the_content_filter($content) {
// array of custom shortcodes requiring the fix
$block = join("|",array("col","shortcode2","shortcode3"));
// opening tag
@luetkemj
luetkemj / wp-query-ref.php
Last active September 14, 2024 13:06
WP: Query $args
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.github.io
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php
*/
@mattwiebe
mattwiebe / wp_plugin_stub.php
Created January 10, 2012 18:05
A good starting place for a static class-based WordPress plugin
<?php
/*
Plugin Name: A Plugin Name
Plugin URI: http://somadesign.ca/
Description: Be descriptive.
Version: 0.1
Author: Soma Design
Author URI: http://somadesign.ca/
License: GPL v2