Skip to content

Instantly share code, notes, and snippets.

Kevin Hoffman kevinwhoffman

Block or report user

Report or block kevinwhoffman

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kevinwhoffman
kevinwhoffman / style.css
Created Jun 24, 2018
Shift Breakpoint of WP List Table
View style.css
/**
* The layout of a WP List Table typically changes from a multi-column to
* single-column layout when the viewport width is less than or equal to 782px.
* This CSS shifts that breakpoint to 960px for tables with more columns that
* would otherwise become squished if they were all crammed on screen at once.
*/
@media screen and ( max-width: 960px ) {
/* WP List Table Options & Filters */
.tablenav {
@kevinwhoffman
kevinwhoffman / zap.js
Created Jan 31, 2018
Hourly Help Scout Unassigned Alert
View zap.js
fetch('https://api.helpscout.net/v1/mailboxes/{YOUR_MAILBOX_ID}/folders.json', {
headers: {
"Authorization": "Basic {YOUR_HELP_SCOUT_API_KEY}"
}
})
.then(function (res) {
return res.json();
})
.then(function (body) {
var output = {
View 2017-wordcamp-us-job-board.md

The following table is a transcription of the job board at WordCamp US on December 1-3, 2017. The table includes a combination of individuals and companies that are either seeking jobs or hires related to WordPress.

Post Contact
Looking for affiliates to build church websites. aboundant.com
WordPress devs helping agencies and businesses. gtadev.ca
A full service digital agency can assist you with any of your WP needs. krishaweb.com
Web developer, WP, HTML, CSS, PHP. uark.edu
I do support. Hire me! kait.blog
I am a technical writer with WP and freelance writing experience. Nicole Plumlee Arguello, sites.uark.edu/blog
@kevinwhoffman
kevinwhoffman / resources-web-developers-designers.md
Last active Nov 13, 2018
Resources for Web Developers and Designers
View resources-web-developers-designers.md

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

@kevinwhoffman
kevinwhoffman / pre-populate-cf-field-slug.php
Created Apr 14, 2017
Pre-populate Caldera Forms field based on slug
View pre-populate-cf-field-slug.php
<?php
/**
* Pre-populate First Name field if user is logged in.
*/
function filter_caldera_forms_render_get_field_first_name( $field, $form ) {
$current_user = wp_get_current_user();
if ( is_user_logged_in() ) {
$field['config']['default'] = $current_user->user_firstname;
}
View save-term-on-save-post.php
<?php
function prefix_set_client_id( $post_id, $post, $update ) {
$client_id_term = get_the_title( $post_id );
wp_set_object_terms( $post_id, $client_id_term, 'client_id' );
}
add_action( 'save_post_clients', 'prefix_set_client_id', 10, 3 );
@kevinwhoffman
kevinwhoffman / acf-seo-image.php
Last active Apr 6, 2017 — forked from bahia0019/acf-seo-image.php
For ACF users, creates an easy to use function that wraps your image in HTML5 <figure> adds <figcaption>. Also adds Schema markup in JSON LD. Parameters are 1. ACF field name, 2. Size, 3. Figure CSS class, 4. Figcaption CSS class.
View acf-seo-image.php
function fsc_figure( $image, $size, $imageclass, $captionclass ){
/**
* Let plugins pre-filter the image meta to be able to fix inconsistencies in the stored data.
*
* @param string $image The ACF field name (i.e. 'your_photo_name').
* @param string $size Thumbnail size (i.e. 'Thumbnail', 'Medium', 'Large')
* @param string $imageclass The Figure class you want to use (ex: 'my-figure')
* @param string $captionclass The Figcaption class you want to use (ex: 'caption-blue')
*/
@kevinwhoffman
kevinwhoffman / add-styles-to-visual-editor.php
Last active Sep 4, 2017
Add customizer styles to visual editor
View add-styles-to-visual-editor.php
<?php
/**
* Adds styles from customizer to head of TinyMCE iframe.
* These styles are added before all other TinyMCE stylesheets.
* h/t Otto.
*/
function kwh_add_editor_style( $mceInit ) {
// This example works with Twenty Sixteen.
$background_color = get_theme_mod( 'background_color' );
$styles = '.mce-content-body { background-color: #' . $background_color . '; }';
@kevinwhoffman
kevinwhoffman / editor-styles-from-customizer.php
Last active Jul 14, 2016
Build editor stylesheet from customizer settings
View editor-styles-from-customizer.php
<?php
// Place in functions.php of Twenty Sixteen to see editor background take on color of customizer background.
/**
* Build editor stylesheet from customizer settings upon customizer save.
*/
function kwh_build_stylesheet() {
$upload_dir = wp_upload_dir();
$stylesheet = $upload_dir['basedir'] . '/kwh-editor-style.css';
$styles = '';
@kevinwhoffman
kevinwhoffman / talk-submission.md
Created Jul 8, 2016
Demystifying Responsive Images in WordPress
View talk-submission.md

Demystifying Responsive Images in WordPress

Whether you are an advanced WordPress theme developer or simply editing content from the dashboard, there is one question that everyone asks at one point or another:

What size should my images be?

This already complex question takes on a whole new dynamic with the recent addition of responsive images in WordPress 4.4. While the basic concept of responsive images may be easy to grasp, a true understanding of the inner workings is far more elusive. In this talk, we will demystify responsive images and learn how to strike a proper balance between image performance and image quality within any context.

Below is a brief overview of the main points we will touch upon throughout this talk:

You can’t perform that action at this time.