Skip to content

Instantly share code, notes, and snippets.

View soderlind's full-sized avatar

Per Søderlind soderlind

View GitHub Profile
@Rarst
Rarst / r-debug.php
Last active November 10, 2024 09:42
R Debug (set of dump helpers for debug)
<?php
/*
Plugin Name: R Debug
Description: Set of dump helpers for debug.
Author: Andrey "Rarst" Savchenko
Author URI: https://www.rarst.net/
License: MIT
*/
@Coopeh
Coopeh / get_domain_mapped_url.php
Created December 18, 2012 19:25
Get Domain Mapped URL From BlogID
<?php
// Function to get a blog/site's domain mapped url.
//
// You need to call it with a blog ID
//
// Example:
// $custom_blog_id = '14';
// echo get_domain_mapped_url( $custom_blog_id );
//
<?php
/*
* Since PHP5 there is no need to pass an reference of $this
*
* @see http://php.net/manual/en/language.oop5.references.php
* [...] As of PHP 5, an object variable doesn't contain the object itself as value anymore [...]
*/
add_action( 'load-upload.php', array( $this, 'custom_bulk_action' ) );
@brasofilo
brasofilo / wp-admin-pointers.php
Last active September 3, 2023 20:25
WordPress Admin Pointers : based on code by Stephen Harris, Tim D and Frank Bueltge. See: http://stackoverflow.com/a/19328125/1287812 and http://brasofilo.com/como-incluir-admin-pointers-en-tu-theme-o-plugin
<?php
/**
* Plugin Name: My Amdin Pointers
* Plugin URI: https://gist.github.com/brasofilo/6947539
* Version: 0.1
* Author: Rodolfo Buaiz
* Author URI: http://brasofilo.com
* Licence: GPLv3
*
@jeremyjaymes
jeremyjaymes / filetype-extension.php
Last active May 22, 2024 17:27
WordPress Get Attachment File Type Extension
<?php
/**
* Get attachment file type extension
*
* Requires that you have the attachment id
* See this post http://jeremyjaymes.com/display-attach…ordpress-theme/ for more explanation
*/
//* Assumes we're in a loop and have our attachment id already
$file_url = wp_get_attachment_url( $file_id );
@jaydansand
jaydansand / wp_allow_update_notifications.php
Last active January 3, 2022 17:45
WordPress plugin to allow module/theme/core update notifications even when DISALLOW_FILE_MODS is TRUE.
<?php
/*
Plugin Name: Allow Update Notifications
Plugin URI: https://gist.github.com/jaydansand/2e41490a8b040a199db4
Description: WordPress plugin to allow module/theme/core update notifications even when DISALLOW_FILE_MODS is TRUE.
Version: 1.0
Author: Jay Dansand, Technology Services, Lawrence University
Author URI: https://gist.github.com/jaydansand
*/
/* Copyright 2014 Lawrence University
@lumpysimon
lumpysimon / gist:5a68f561fd2381e64efe
Last active March 8, 2016 17:06
Example WordPress custom post type and taxonomy definitions using Extended CPTs and Extended Taxos
register_extended_post_type(
'newsletter',
array(
'capability_type' => 'post',
'hierarchical' => false,
'menu_position' => 45,
'quick_edit' => false,
'supports' => array( 'title', 'editor', 'thumbnail' ),
'admin_cols' => array(
'newsletter-image' => array(
@SGudbrandsson
SGudbrandsson / index.php
Last active September 5, 2024 01:54
Create a WordPress staging area from your live wordpress setup with a Click-of-a-button [TM] ..
<?php
/**
*
* This script will copy your wordpress from public_html (or wherever)
* and place it in a staging folder.
* It will then clone the database, reconfigure the config file
* and replace URL's from the original URL to your staging URL.
* It will then make sure to NOT allow search engines to index the page.
*
* Use this script to clone your main wp in order to test maintenance work
@neilgee
neilgee / custom-provision.sh
Created July 13, 2015 02:58
Custom VVV Variable Provisioning for WordPress sites
# #!/bin/bash
# #
# # provision.sh
# #
# # This file is specified in Vagrantfile and is loaded by Vagrant as the primary
# # provisioning script whenever the commands `vagrant up`, `vagrant provision`,
# # or `vagrant reload` are used. It provides all of the default packages and
# # configurations included with Varying Vagrant Vagrants.
# # By storing the date now, we can calculate the duration of provisioning at the
@morganestes
morganestes / .readme.md
Last active November 9, 2022 18:07
Create multiple sites with wp-cli in WordPress multisite for testing.

These commands will install multiple dummy sites in a WordPress Multisite environment.

I wrote this to easily create an environment to work on https://core.trac.wordpress.org/ticket/15317.

Usage

Shell

In the terminal, inside your WordPress directory: simply copy, paste, and run the one-line command.

You can also add it to a location available in your $PATH and invoke the script from the shell.