Skip to content

Instantly share code, notes, and snippets.

Avatar
😏

Matt Martz sivel

😏
View GitHub Profile
View external-shadowbox-automation.php
<?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
*/
View multi-arg-script.php
<?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') ) {
View feed-pseudo-widget.php
<?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/
*/
View remove_others_children_2.php
<?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;
View attach2post.php
<?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 Aug 5, 2009
Database connection test script for WordPress
View wp-mysql-test.php
<?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 Apr 13, 2010
Test for the minimum file permissions required for the webserver to read a file that it has written
View perm-test.php
<?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 Apr 25, 2010
WordPress Plugin to test for the existence and functionality of wp_head and wp_footer in the active theme
View test-head-footer.php
View status.py
#!/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
Simple WordPress plugin for repointing resource URLs to a CDN pull style host
View sivel-cdn.php
<?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/
*/