Skip to content

Instantly share code, notes, and snippets.

@mikemanger
mikemanger / wp-change-title-placeholder.php
Created February 6, 2014 17:22
Add to WordPress theme's functions.php or plugin. Changes the 'Enter title here' text for certain post types (most examples don't realise you can get the post type from the filter.
/**
* Change the title placeholder text
*/
function my_plugin_change_default_title( $title, $post ){
if ( 'posttype' == $post->post_type ) {
$title = 'Enter new title here';
}
return $title;
}
@mikemanger
mikemanger / update-wp-multisite-domain.sql
Created March 10, 2014 16:23
Run this for each wp_*_options table.
UPDATE wp_x_options
SET option_value = REPLACE(option_value, 'old.domain.com', 'new.domain.com')
WHERE option_name = 'siteurl'
OR option_name = 'home'
OR option_name = 'fileupload_url';
@mikemanger
mikemanger / functions.php
Created March 19, 2014 18:48
Sessions in WordPress themes & plugins.
/**
* Setup last page context.
*/
session_start();
function my_theme_php_shutdown() {
$_SESSION['my_theme_from_search'] = is_search();
}
add_action( 'shutdown', 'my_theme_php_shutdown' );
/**
@mikemanger
mikemanger / reposition-gform-blog-templates.php
Last active August 29, 2015 14:03
(WordPress) Reposition New Blog Templates
<?php
/*
Plugin Name: Reposition New Blog Templates
Description: Move New Blog Template selection to a different Gravity Form page.
Author: Mike Manger
Author URI:
*/
function mm_rnbt_get_form_filter( $form_html, $form ) {
// Let's check if the option for New Blog Templates is activated in this form
@mikemanger
mikemanger / .bashrc
Created September 19, 2013 10:57
I always type `git branches` instead of `git branch` to list my branches, copy this to your .bashrc
# git function for branches
git() { if [[ $@ == "branches" ]]; then command git branch | more; else command git "$@"; fi; }
@mikemanger
mikemanger / postcode-anywhere-example.js
Last active December 31, 2015 20:09
Postcode Anywhere Capture+ hooks
function CapturePlusLoaded(control) {
// Search results
control.listen('populate', function(control, address, variations) {
// Code here
});
// Error results
control.listen('error', function(control, error) {
// Code here
@mikemanger
mikemanger / indieroyale.user.js
Last active December 6, 2016 03:10
Indie Royal Collection Labeler
// ==UserScript==
// @name Indie Royale Bundle Labeler
// @include http://www.indieroyale.com/collection
// @updateURL https://gist.githubusercontent.com/ohmanger/ca837343473033b1d9bb/raw
// @downloadURL https://gist.githubusercontent.com/ohmanger/ca837343473033b1d9bb/raw
// @grant none
// @version 1.3.1
// ==/UserScript==
function irbl_add_global_styles() {
@mikemanger
mikemanger / desura-game-labeler.user.js
Last active December 6, 2016 03:15
Displays titles on your Desura collection page
// ==UserScript==
// @name Desura Game Labeler
// @include http://www.desura.com/collection
// @updateURL https://gist.githubusercontent.com/ohmanger/b057f444cd2d5205bdfc/raw
// @downloadURL https://gist.githubusercontent.com/ohmanger/b057f444cd2d5205bdfc/raw
// @require https://gist.githubusercontent.com/BrockA/2625891/raw
// @grant none
// @version 1.2.2
// ==/UserScript==
@mikemanger
mikemanger / indieroyalebundlehider.user.js
Last active December 6, 2016 03:16
Hides bundles you don't own from your Indie Royale collection page
// ==UserScript==
// @name Indie Royale Bundle Hider
// @description Hides bundles you don't own from your collection page
// @include http://www.indieroyale.com/collection
// @updateURL https://gist.githubusercontent.com/ohmanger/71334947a6f7470ef16e/raw
// @downloadURL https://gist.githubusercontent.com/ohmanger/71334947a6f7470ef16e/raw
// @grant none
// @version 1.1.1
// ==/UserScript==
@mikemanger
mikemanger / humble-bundle-key-cache.user.js
Last active January 20, 2018 20:45
Caches your Humble bundle key list
// ==UserScript==
// @name Humble Bundle key cache
// @include https://www.humblebundle.com/home*
// @updateURL https://gist.githubusercontent.com/mikemanger/b5bb71c9b9a1ac70b7ad/raw
// @downloadURL https://gist.githubusercontent.com/mikemanger/b5bb71c9b9a1ac70b7ad/raw
// @grant GM_setValue
// @grant GM_getValue
// @run-at document-end
// @version 1.1.4
// ==/UserScript==