Skip to content

Instantly share code, notes, and snippets.

View jtsternberg's full-sized avatar
😎
Awesome Motive-ing

Justin Sternberg jtsternberg

😎
Awesome Motive-ing
View GitHub Profile
@jazzsequence
jazzsequence / cmb2_add_field.sublime-snippet
Last active July 11, 2016 21:21
Sublime Text snippets
<snippet>
<content><![CDATA[
->add_field( array(
'name' => __( '${1:Field Name}', '${2:textdomain}' ),
'id' => \$prefix . '${3:field_id}',
'type' => '${4:cmb2_field_type}',
'desc' => __( '${5:Description of the field.}', '${2:textdomain}' ),
${6:'options' =>} ${7:${8:array of options or callback function},}
${9:'attributes' =>} ${10:${11:array of attributes},}
${12:'default' =>} ${13:'${14:default_value}',}
@jazzsequence
jazzsequence / update.sql
Created February 12, 2016 21:24
Update wp_postmeta and wp_posts database tables with posts from another site
# What if you are trying to migrate a bunch of posts from one site into
# another site that already has content? We'll assume you already have
# a database export of the posts and postmeta you want to migrate. You
# will want to create a database locally to alter the tables to get them
# ready to merge into the production database that already has content.
# You will also need to know the highest `meta_id` and `ID` values from
# the `wp_postmeta` and `wp_posts` tables, respectively.
# First, we need to create new columns in the tables we have locally. To
# do this the right way, we are going to figure out what type of data
@johnbillion
johnbillion / wp_mail.md
Last active June 3, 2024 13:31
WordPress Emails

WordPress Emails

This document lists all the situations where WordPress sends an email, along with how to filter or disable each email.

This documentation has moved here: https://github.com/johnbillion/wp_mail

@bradp
bradp / say
Last active September 17, 2015 14:41
say
voices=(
Agnes
Albert
Alex
Alice
Alva
Amelie
Anna
Bad
Bahh
@jtsternberg
jtsternberg / download-insta-images-script.md
Last active January 15, 2019 23:24
Script to download high-res images from user's profile on the instagram site
@jtsternberg
jtsternberg / CMB2_Search_Get_Extra_Post_Data.php
Last active August 29, 2015 14:27
Update CMB2 Post Search Field to ajax-grab more post-data and use that to populate fields. https://github.com/WebDevStudios/CMB2-Post-Search-field
<?php
/**
* Modify CMB2-Post-Search-Field to output more than just an id
* @link https://github.com/WebDevStudios/CMB2-Post-Search-field
*/
class CMB2_Search_Get_Extra_Post_Data {
protected static $single_instance = null;
@jtsternberg
jtsternberg / modify-google-top-content-query-params.php
Created May 15, 2015 13:45
Modify the google analytics request params in the google top content plugin
<?php
/**
* Change metric from 'ga:pageViews' for top-content widget and shortcode
*
* @link https://ga-dev-tools.appspot.com/query-explorer/ Google's Query Explorer for more info
*
* @param array $params Array of request params
*
* @return array Modified array of request params
*/
@jtsternberg
jtsternberg / instagram-importer-make-title-date.php
Last active April 27, 2016 01:34
Make instagram imported posts' titles to be the date of the imported image
<?php
/*
Plugin Name: DsgnWrks Instagram Importer - Make Title the Image Date
Plugin URI: http://dsgnwrks.pro/plugins/dsgnwrks-instagram-importer
Description: Set the title of your instagram posts to the date the image was taken
Author URI: http://dsgnwrks.pro
Author: DsgnWrks
Donate link: http://dsgnwrks.pro/give/
Version: 0.1.0
*/
@jtsternberg
jtsternberg / ajax-endpoint.js
Last active February 1, 2021 06:00
Proof of concept for avoiding admin-ajax for ajax callback requests. Also see Thomas Griffin's excellent post: https://thomasgriffin.io/a-creative-approach-to-efficient-and-scalable-wordpress-api-endpoints/ AND Josh Pollock's excellent post: http://torquemag.io/improved-wordpress-front-end-ajax-processing/
jQuery(document).ready(function($){
$('body').on( 'click', '.some-button', function(){
$.ajax( ajax_endpoint_data.api_url, {
type : 'POST',
dataType : 'json',
data : {
action: 'ajax_action',
some_data: 'some_value'
}
@johnbillion
johnbillion / gist:4fa3c4228a8bb53cc71d
Last active February 18, 2025 13:06
WordPress Flow
INITIALISATION
==============
load wp-config.php
set up default constants
load wp-content/advanced-cache.php if it exists
load wp-content/db.php if it exists
connect to mysql, select db
load object cache (object-cache.php if it exists, or wp-include/cache.php if not)
load wp-content/sunrise.php if it exists (multisite only)