Skip to content

Instantly share code, notes, and snippets.

View pjohanneson's full-sized avatar
💭
Scribblin'

Patrick Johanneson pjohanneson

💭
Scribblin'
View GitHub Profile
@pjohanneson
pjohanneson / functions.php
Created January 9, 2019 15:48
pre_get_posts sorting on multiple meta keys
add_action( 'pre_get_posts', 'sort_by_lname_then_fname' );
/**
* Sort by last name then first name. `lname` and `fname` are the meta keys.
*
* @param WP_Query $query The query. Passed by reference.
* @return void
* @link https://support.advancedcustomfields.com/forums/topic/pre_get_posts-order-posts-by-two-different-meta_keys-acf-select-field/
*/
function sort_by_lname_then_fname( &$query ) {
if ( $query->is_main_query() && $query->is_post_type_archive( 'speaker' ) ) {
@pjohanneson
pjohanneson / class-generic-plugin-settings.php
Last active January 3, 2019 19:57
WordPress Settings API quickstart
<?php
/**
* Settings class file.
*
* @package generic-plugin
*/
/**
* Settings class.
*

Contract Killer 3

Revised date: 07/11/2012

Between us [company name] and you [customer name]

Summary:

We’ll always do our best to fulfil your needs and meet your expectations, but it’s important to have things written down so that we both know what’s what, who should do what and when, and what will happen if something goes wrong. In this contract you won’t find any complicated legal terms or long passages of unreadable text. We’ve no desire to trick you into signing something that you might later regret. What we do want is what’s best for both parties, now and in the future.

@pjohanneson
pjohanneson / WCWPG-slides.md
Last active August 29, 2015 14:23
WordCamp Winnipeg Talks