Skip to content

Instantly share code, notes, and snippets.

View mommaroodles's full-sized avatar

Melanie Shepherd mommaroodles

View GitHub Profile
<?php
// Add this as a mu-plugin.
if ( isset( $_GET['wp_maybe_auto_update'] ) ) {
add_filter( 'automatic_updates_is_vcs_checkout', '__return_false' );
add_action( 'template_redirect', function() {
$time = date( 'r' );
echo "Starting... $time<br />";
delete_site_option( 'auto_core_update_failed' );
@mommaroodles
mommaroodles / 0_reuse_code.js
Created December 8, 2013 21:45
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@mommaroodles
mommaroodles / redirect-folder-to-subdomain.txt
Created December 11, 2013 10:07
Redirect A Folder To A Subdomain
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com$1 [L,R=301]
RedirectMatch 301 ^/blog/(.*)$ http://blog.example.com/$1
@mommaroodles
mommaroodles / functions.php
Created December 11, 2013 10:11
Force Browsers To Load Latest CSS And JS
<?php
add_action( 'wp_enqueue_scripts', 'add_styles' );
function add_styles()
{
$css_file = get_stylesheet_directory() . '/css/style.css';
wp_enqueue_style( 'css-file', get_stylesheet_directory_uri().'/css/style.css', NULL, filemtime($css_file) );
}
?>
@mommaroodles
mommaroodles / new_gist_file.php
Created December 11, 2013 10:23
PHP Include All Files In A Folder
<?php
foreach (glob('folder/*.php') as $filename)
{
include_once $filename;
}
new Class();
new ClassTwo();
new ClassThree();
?>
@mommaroodles
mommaroodles / htaccess.txt
Created December 11, 2013 11:38
Fontawesome Firefox Cross Domain font issue fix
<FilesMatch "\.(ttf|otf|eot|woff)$">
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
</FilesMatch>
@mommaroodles
mommaroodles / new_gist_file
Created January 4, 2014 08:24
Custom Functions
<?php
function ww_remove_version() {
return '';
}
add_filter('the_generator', 'ww_remove_version');
// unregister all default WP Widgets
function unregister_default_wp_widgets() {
unregister_widget('WP_Widget_Pages');
<?php
// Forked from: http://stackoverflow.com/questions/1159216/how-can-i-get-php-to-produce-a-backtrace-upon-errors/1159235#1159235
function process_error_backtrace($errno, $errstr, $errfile, $errline) {
if(!(error_reporting() & $errno))
return;
switch($errno) {
case E_WARNING :
case E_USER_WARNING :
case E_STRICT :
## FILL ##
fill Sets fill color of the shape.
fill-opacity Sets fill opacity of the shape.
fill-rule Sets fill rule of the shape.
** example **
fill: #ccc;
fill: rgba(0,0,0,.5);
fill: red;
<?php
//* Do NOT include the opening php tag
//* Customize the entry meta in the entry header (requires HTML5 theme support)
add_filter( 'genesis_post_info', 'sp_post_info_filter' );
function sp_post_info_filter($post_info) {
$post_info = '[post_date] by [post_author_posts_link] [post_comments] [post_edit]';
return $post_info;
}