Skip to content

Instantly share code, notes, and snippets.

View theblanchard's full-sized avatar

John Blanchard theblanchard

View GitHub Profile
@theblanchard
theblanchard / wp-author-import-auto-select.js
Created May 5, 2021 17:10 — forked from purplefeel/wp-author-import-auto-select.js
Auto-select authors for posts during WordPress import. They must already be assigned to the project. Enable jQuery in a plugin or functions.php, and paste this in the browser console.
(function($){
$('#authors li').each(function(key, value) {
var name = $(this).children('strong').first().html();
var re = /\s\([^\)]+\)/gi;
name = name.replace(re, '');
name = name.replace(':', '');
name = name.replace("'", "");
name = name.replace(".", "");
name = name.replace("&", "");
@theblanchard
theblanchard / wp_delete_revisions.php
Last active October 19, 2017 16:36 — forked from mrazzari/multisite_delete_revisions.php
WP - Multisite delete revisions
<pre><?php
// WordPress - Delete all revisions from all posts greater than 1 year old.
// Credit to @mrazzari, 2014.
// For context see this thread started by Kitchin at the forums:
// http://wordpress.org/support/topic/deleting-post-revisions-do-not-use-the-abc-join-code-you-see-everywhere
// HOWTO
// This snippet is meant to be called as a standalone script.
// Like http://example.com/tmp/wp_delete_revisions.php
@theblanchard
theblanchard / override.css
Created March 3, 2017 17:15 — forked from cougrimes/override.css
Marketo Forms 2.0 mobile class reset
@media only screen and (max-width: 480px), only screen and (max-device-width: 480px), only screen and (max-device-height:480px){
.mktoForm,.mktoForm *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;-moz-box-sizing:border-box;padding:auto}
/* Yes, I know padding:auto isn't a real property - had to break things somehow :( */
.mktoLabel.mktoHasWidth {height: inherit !important;}
.mktoForm .mktoGutter,.mktoForm .mktoOffset{display:initial !important}
.mktoForm .mktoFormCol .mktoLabel{text-align:left;width:initial !important}
.mktoForm .mktoFormCol{float:initial !important}
.mktoForm .mktoFieldWrap{float:initial !important}
.mktoForm fieldset{padding:initial !important}
.mktoForm input[type=url],.mktoForm input[type=text],.mktoForm input[type=date],.mktoForm input[type=tel],.mktoForm input[type=email],.mktoForm input[type=number],.mktoForm textarea.mktoField,.mktoForm select.mktoField{width:100% !important;height:initial !important;line-height:initial !important;font-size:initial !i
@theblanchard
theblanchard / apple-mq.css
Created March 23, 2016 16:30 — forked from AllThingsSmitty/apple-mq.css
iPhone 6/6 Plus and Apple Watch CSS media queries
/* iPhone 6 landscape */
@media only screen and (min-device-width: 375px)
and (max-device-width: 667px)
and (orientation: landscape)
and (-webkit-min-device-pixel-ratio: 2)
{ }
/* iPhone 6 portrait */
@media only screen
and (min-device-width: 375px)
@theblanchard
theblanchard / is_child.php
Last active September 3, 2015 22:29 — forked from ericrasch/is_child.php
WordPress conditional function to check if a page is a parent/child/ancestor. In other words, if the page is within a tree of another page, show the code. Other code I've seen either only work with IDs, only check if it's a child, or detect all subpages (even outside of the direct tree).
/* =BEGIN: Check If Page Is Child
Source: http://bavotasan.com/2011/is_child-conditional-function-for-wordpress/
---------------------------------------------------------------------------------------------------- */
function is_child( $page_id_or_slug ) { // $page_id_or_slug = The ID of the page we're looking for pages underneath
global $post; // load details about this page
if ( !is_numeric( $page_id_or_slug ) ) { // Used this code to change a slug to an ID, but had to change is_int to is_numeric for it to work.
$page = get_page_by_path( $page_id_or_slug );
$page_id_or_slug = $page->ID;
}
@theblanchard
theblanchard / Contract Killer 3.md
Last active August 29, 2015 14:17
Contract Killer

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23/12/2008
  • Revised date: 15/12/2013
  • Original post