Instantly share code, notes, and snippets.

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 {
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
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

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 );
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')
*/
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 . '; }';
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 = '';
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: