Skip to content

Instantly share code, notes, and snippets.

@PeteMall
PeteMall / filter-upload-mime-types.php
Created October 11, 2012 18:08
Add SVG to the allowed mime types in WordPress
function cc_mime_types( $mimes ){
$mimes['svg'] = 'image/svg+xml';
return $mimes;
}
add_filter( 'upload_mimes', 'cc_mime_types' );
@PeteMall
PeteMall / .htaccess
Created June 20, 2012 15:34 — forked from johnpbloch/.htaccess
.htaccess Extras for WordPress-Skeleton
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^(wp-admin/.*)$ /wp/$1 [L]
RewriteRule ^(wp-[^/]+\.php)$ /wp/$1 [L]
RewriteRule ^xmlrpc\.php$ /wp/xmlrpc.php [L]
RewriteRule ^(wp-includes/.*)$ /wp/$1 [L]
</IfModule>
# BEGIN WordPress
@PeteMall
PeteMall / plugin-last-updated.php
Created June 19, 2012 20:00
Display the last updated date for all plugins from the WordPress.org plugins repo.
<?php
/*
Plugin Name: Plugin Last Updated
Version: 1.0
License: GPL
Author: Pete Mall, Range
Author URI: http://petemall.com/
Description: Display the last updated date for all plugins from the <a href="http://wordpress.org/extend/plugins/">WordPress.org plugins repo</a>.
*/
@PeteMall
PeteMall / wp-honeybadger.php
Created January 21, 2012 01:50
This is just the beginning
<?php
add_action( 'init', 'wp_honeybadger_it' );
function wp_honeybadger_it() {
remove_filter( 'the_content', 'capital_P_dangit', 11 );
remove_filter( 'the_title', 'capital_P_dangit', 11 );
remove_filter( 'comment_text', 'capital_P_dangit', 31 );
// more to come...
@PeteMall
PeteMall / svn-rev.php
Created September 9, 2011 18:16
Show svn revision in the "Right Now" dashboard widget
<?php
function pm_right_now_svn_revision() {
if ( ! $svn = File( '.svn/entries' ) )
return;
echo "<p>SVN Revision: {$svn[3]}</p>";
}
add_action( 'rightnow_end', 'pm_right_now_svn_revision' );
?>
@PeteMall
PeteMall / svn-rev.php
Created September 9, 2011 16:49
Show the svn revision in admin footer.
<?php
function pm_svn_revision( $msg = '' ) {
if ( $svn = File( '.svn/entries' ) )
$msg .= ' SVN Revision: ' . $svn[3];
return $msg;
}
add_action( 'update_footer', 'pm_svn_revision', 99 );
?>
<?php
add_filter( 'manage_post_posts_columns', 'pm_add_col' );
function pm_add_col( $cols ) {
$cols['post_id'] = 'ID';
return $cols;
}
add_filter( 'manage_posts_custom_column', 'pm_display_col', 10, 2 );
function pm_display_col( $col, $post_id ) {
if ( 'post_id' == $col )
--- wp-includes/script-loader.php (revision 16232)
+++ wp-includes/script-loader.php (working copy)
@@ -368,7 +368,7 @@
$scripts->add_data( 'list-table', 'group', 1 );
$scripts->localize( 'list-table', 'listTableL10n', array(
'loading' => __('Loading...'),
- 'error' => __('An error has occured while loading the items.'),
+ 'error' => __('An error has occurred while loading the items.'),
'search' => __('Search results for &#8220;%s&#8221;')
) );
@PeteMall
PeteMall / you-to-u-dangit.php
Created November 7, 2010 22:56
Replaces you with U in the content.
<?php
foreach ( array( 'the_content', 'the_title', 'comment_text' ) as $filter )
add_filter( $filter, 'you_to_u_dangit', 11 );
function you_to_u_dangit( $content ) {
static $dblq = false;
$style = '<span style="color: red">';
if ( false === $dblq )
$dblq = _x('&#8220;', 'opening curly quote');
@PeteMall
PeteMall / linkify-urls.php
Created October 28, 2010 22:52
WordPress Plugin to converts URLs in the post content to links.
<?php
/*
Plugin Name: Linkify URLs
*/
add_filter( 'the_content', 'linkify_urls' );
function linkify_urls( $content ){
return preg_replace( '/\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|$!:,.;]*[A-Z0-9+&@#\/%=~_|$]/i', '<a href="$0">$0</a>', $content );
}