Skip to content

Instantly share code, notes, and snippets.

View sivel's full-sized avatar
😏

Matt Martz sivel

😏
View GitHub Profile
<?php
/*
Plugin Name: External Shadowbox Automation
Plugin URI: http://sivel.net/wordpress/
Description: Automatically adds Shadowbox the activator to external links in your post content
Author: Matt Martz
Author URI: http://sivel.net
Version: 11
*/
<?php
/*
Plugin Name: multi-arg-script
Plugin URI: http://sivel.net/wordpress/
Description: multi-arg-script
Version: 10
Author: Matt Martz
Author URI: http://sivel.net
*/
if ( defined('ABSPATH') ) {
<?php
/*
Plugin Name: feed-pseudo-widget
Plugin URI: http://wordpress.org/#
Description: feed-pseudo-widget
Author: Matt Martz
Version: 1.0
Author URI: http://sivel.net/
*/
<?php
add_filter('wp_list_pages_excludes', 'remove_others_children');
function remove_others_children($excludes = array()) {
$all_pages = get_pages();
$all_children = (array) get_page_children(true, $all_pages);
foreach ( $all_children as $child )
$excludes[] = $child->ID;
if ( ! is_page() )
return $excludes;
<?php
$attachments = get_children('&post_type=attachment&post_mime_type=image&post_parent=true');
foreach ( $attachments as $attach )
echo "<a href='" . get_permalink($attach->post_parent) . "'><img src='" . wp_get_attachment_thumb_url($attach->ID) . "' alt='' /></a>";
?>
@sivel
sivel / wp-mysql-test.php
Created August 5, 2009 20:04
Database connection test script for WordPress
<?php
/**
* Database connection test script for WordPress
*
* Parses the wp-config.php file for DB connection information and tests
* a mysql connection to the DB server and selection of the database.
* Errors will be reported. Attempts will be made to repair table errors.
*
* Place this file in the same directory as wp-config.php
*
@sivel
sivel / perm-test.php
Created April 13, 2010 18:59
Test for the minimum file permissions required for the webserver to read a file that it has written
<?php
function perm_test() {
$file = '.perm_test';
@touch( $file );
if ( ! is_readable( $file ) )
return false;
$perms = array( 0666, 0664, 0644, 0660, 0640, 0600, 0444, 0440, 0400 );
$lastperm = 0666;
@sivel
sivel / test-head-footer.php
Created April 25, 2010 14:46
WordPress Plugin to test for the existence and functionality of wp_head and wp_footer in the active theme
#!/usr/bin/python
import urllib, re, sys
def content_match(url, match, nocase):
uh = urllib.urlopen(url)
if re.search(match, uh.read(), re.I if nocase else 0) and uh.getcode() == 200:
return [True, uh.geturl(), uh.getcode()]
else:
return [False, uh.geturl(), uh.getcode()]
@sivel
sivel / sivel-cdn.php
Created May 17, 2010 20:29
Simple WordPress plugin for repointing resource URLs to a CDN pull style host
<?php
/*
Plugin Name: Sivel CDN
Plugin URI: http://sivel.net/
Description: Points media urls at a CDN
Version: 1.0
Author: Matt Martz
Author URI: http://sivel.net/
*/