Skip to content

Instantly share code, notes, and snippets.

@seancojr
seancojr / gist:a19e488decd9104ee075
Last active April 1, 2016 22:33 — forked from theukedge/gist:68fe7e0cf4a10700774f
Don't email webmaster for comment moderation
<?php
// Don't email webmaster for comment moderation
function pref_dont_email_webmaster( $emails, $comment_id ) {
$webmaster_email = get_option('admin_email');
if ( $emails[0] == $webmaster_email )
unset($emails[0]);
return (array) $emails;
}
<?php
add_filter( 'wp-tiles-data', 'fixed_page_tiles', 10, 4 );
function fixed_page_tiles( $data, $posts, $colors, $tiles_obj ) {
$pages = get_pages();
foreach ( $pages as $page ) {
$position = get_post_meta( $page->ID, 'tile-position', true );
if ( empty ( $position ) || ! is_numeric ( $position ) )
continue;
@seancojr
seancojr / backup-scheduler.php
Created April 5, 2014 01:35 — forked from pento/backup-scheduler.php
Backup scheduler for WordPress Automatic Updates
<?php
function my_backup_scheduler( $event ) {
// 'wp_maybe_auto_update' is the cron hook for the auto update process
if ( 'wp_maybe_auto_update' !== $event['hook'] )
return;
wp_schedule_single_event( $event['timestamp'] - 5 * MINUTE_IN_SECONDS, 'my_backup' );
}
add_filter( 'schedule_event', 'my_backup_scheduler', 10, 1 );
<?php
add_action( 'admin_init', 'wprss_et_activate_deactivate_license' );
/**
* Handles the activation/deactivation process
*
* @since 1.1
*/
function wprss_et_activate_deactivate_license() {
// listen for our activate button to be clicked
<?php
/**
* Custom "Download" custom type for tutorial on Jayj.dk
*
* @link http://jayj.dk/2011/download-cpt-wordpress
*/
add_action( 'init', 'jayj_create_download_post_type' );
<a href="https://bufferapp.com/add" class="buffer-add-button" data-count="vertical">Buffer</a>
<script type="text/javascript" src="https://d389zggrogs7qo.cloudfront.net/js/button.js"></script>
@seancojr
seancojr / gist:4141150
Created November 24, 2012 19:41 — forked from DrewAPicture/gist:2243601
WordPress responsive captions
function dap_responsive_img_caption_filter( $val, $attr, $content = null ) {
extract( shortcode_atts( array(
'id' => '',
'align' => '',
'width' => '',
'caption' => ''
), $attr
) );
if ( 1 > (int) $width || empty( $caption ) )
@seancojr
seancojr / dump_tables.php
Created May 8, 2012 14:08 — forked from dprevite/dump_tables.php
Dump every table from every database into its own sql file (Fancy PHP version)
#!/usr/bin/php
<?php
// Install these with PEAR
require_once 'Console/CommandLine.php';
require_once 'Console/Color.php';
require_once 'Console/ProgressBar.php';
define('NL', "\n");
@seancojr
seancojr / dump_tables.sh
Created May 8, 2012 14:07 — forked from dprevite/dump_tables.sh
Dump every table from every database into its own sql file
#!/bin/bash
# Simple MySQL dump script which dumps each database to a compressed
# file with the date included in the file name
MYSQL='/usr/bin/mysql'
MYSQLDUMP='/usr/bin/mysqldump'
DUMPOPTS='--opt --hex-blob --skip-extended-insert'
@seancojr
seancojr / .gitignore
Created April 23, 2012 16:35 — forked from redoPop/.gitignore
Template .gitignore file for WordPress projects
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your