Skip to content

Instantly share code, notes, and snippets.

* {
font-family: Helvetica, sans-serif;
box-sizing: border-box;
}
body {
height: 100%;
background-color: black;
color: white;
}
@eddieajau
eddieajau / debug.php
Created May 10, 2012 05:18
Printing a clean debug backtrace in PHP.
// PHP < 5.3.6
foreach (debug_backtrace() as $trace)
{
echo sprintf("\n%s:%s %s::%s", $trace['file'], $trace['line'], $trace['class'], $trace['function']);
}
die;
// PHP >= 5.3.6
debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
die;
@bgallagh3r
bgallagh3r / wp.sh
Last active March 23, 2025 19:40
Wordpress: Bash Install Script -- Downloads latest WP version, updates wp-config with user supplied DB name, username and password, creates and CHMOD's uploads dir, copies all the files into the root dir you run the script from, then deletes itself!
#!/bin/bash -e
clear
echo "============================================"
echo "WordPress Install Script"
echo "============================================"
echo "Database Name: "
read -e dbname
echo "Database User: "
read -e dbuser
echo "Database Password: "
@rolandinsh
rolandinsh / smc_is_login_page
Created July 11, 2012 09:09
WordPress is login or register page
<?php
/**
* Is login or register page
* @author umbrovskis
* @authorlink http://umbrovskis.com
*/
function smc_is_login_page() {
return in_array($GLOBALS['pagenow'], array('wp-login.php', 'wp-register.php'));
}
// hope some day WordPress will make is_login_page() or is_register_page() or similar
@scribu
scribu / taxonomy-columns.php
Created July 12, 2012 15:35
'show_admin_column' => true
<?php
add_action( 'registered_taxonomy', array( 'APP_Tax_Admin_Column', 'register_column' ), 10, 3 );
/**
* Generates a column with the associated terms,
* for any taxonomy with 'show_admin_column' => true
*/
class APP_Tax_Admin_Column {
@ocean90
ocean90 / auto-embeds-disabler.php
Created September 27, 2012 21:42
WordPress Plugin: Auto-embeds Disabler
<?php
/**
* Plugin Name: Auto-embeds Disabler
* Version: 0.1
* Description: Disables the auto-embeds function in WordPress 3.5
* Author: Dominik Schilling
* Author URI: http://wphelper.de/
* Plugin URI: http://wpgrafie.de/1078/
*
*
@scribu
scribu / wp-query-log.php
Created October 7, 2012 22:52
Log WP_Query calls
<?php
/**
* Wrapper around WP_Query; logs various actions.
*
* After writing it, I realized that it's better to just step through the code using Xdebug.
*/
class WP_Query_Log {
private $original;
@petenelson
petenelson / admin_head_post_edit_check.php
Created November 1, 2012 17:03
WordPress admin action hooks for listing/adding/editing posts or pages
/* actions fired when listing/adding/editing posts or pages */
/* admin_head-(hookname) */
add_action( 'admin_head-post.php', 'admin_head_post_editing' );
add_action( 'admin_head-post-new.php', 'admin_head_post_new' );
add_action( 'admin_head-edit.php', 'admin_head_post_listing' );
function admin_head_post_editing() {
echo 'you are editing a post';
}
@dnaber-de
dnaber-de / dna-framebreaker.php
Created November 9, 2012 13:25
Wordpress Plugin to add a framebreaker javascript to the header.
<?php
/**
* Plugin Name: dna Framebreaker
* Plugin URI: https://gist.github.com/4045656
* Description: Add a framebreaker javascript to the header. (Requires PHP 5.3)
* Version: 0.1
* Author: David Naber
* Author URI: http://dnaber.de
* License: MIT
* License URI: http://opensource.org/licenses/MIT
/*
* jGFeed 1.0 - Google Feed API abstraction plugin for jQuery
*
* Copyright (c) 2009 jQuery HowTo
*
* Licensed under the GPL license:
* http://www.gnu.org/licenses/gpl.html
*
* URL:
* http://jquery-howto.blogspot.com