Skip to content

Instantly share code, notes, and snippets.

@mjangda
mjangda / autosaver.js
Created March 3, 2010 05:42
How to hook into and pass your plugin data though WordPress Autosave
// Must be in an external file or loaded at the end of wp_footer()
jQuery(document).ajaxSend(function(e, x, a) {
var awesome = 1;
a.data += '&' + jQuery.param( {is_awesome: awesome} );
});
<?php
/*
Plugin Name: Instrument Hooks for WordPress
Description: Instruments Hooks for a Page. Outputs during the Shutdown Hook.
Version: 0.1
Author: Mike Schinkel
Author URI: http://mikeschinkel.com
*/
if (isset($_GET['instrument']) && $_GET['instrument']=='hooks') {
@scribu
scribu / backtrace-errors.php
Created October 14, 2010 07:25
Backtrace Errors
<?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 :
@hakre
hakre / endpoint-example.php
Created November 18, 2010 20:20
Wordpress Rewrite Endpoint Example
<?php
/**
* Author Endpoints Example
*
* Copyright (C) 2010 hakre <http://hakre.wordpress.com/>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
@franz-josef-kaiser
franz-josef-kaiser / jquery_in_viewport.php
Created March 22, 2011 23:21
load jQuery in WordPress only when comments are inside the viewport
<?php
add_action ( 'wp_head', 'add_jquery_when_comments_in_viewport', 11 );
function add_jquery_when_comments_in_viewport()
{
?>
<script type="text/javascript">
/* <![CDATA[ */
function jquery_for_comments_onLoad() {
var element = document.getElementById( "comments" ),
current = document.body.clientHeight+document.body.scrollTop,
@mfields
mfields / gist:1061846
Created July 3, 2011 00:53
Simple Github commit API shortcode for WordPress
<?php
/*
Plugin Name: Mfields Github Shortcode
Plugin URI: null
Description: Display recent commits from a Github repository.
Version: 0.1
Author: Michael Fields
Author URI: http://wordpress.mfields.org/
License: GPLv2 or later
@aaroncampbell
aaroncampbell / expand-admin-menus.php
Created October 12, 2011 15:23
WordPress Expanded Admin Menus
<?php
/**
* Plugin Name:
* Plugin URI: http://xavisys.com/wordpress-plugins/expanded-admin-menus/
* Description: Forces all admin menus to be expanded all the time
* Version: 0.0.1
* Author: Aaron D. Campbell
* Author URI: http://xavisys.com/
*/
@franz-josef-kaiser
franz-josef-kaiser / insert_menu_separator.php
Last active February 21, 2023 11:21
Add separators to WP Admin menus
<?php
namespace WCM;
// Add the filter
add_action( 'admin_menu', __NAMESPACE__.'\add_menu_separator' );
function add_menu_separator()
{
add_filter( 'add_menu_classes', __NAMESPACE__.'\insert_admin_menu_separator' );
}
@mikeschinkel
mikeschinkel / parks-and-features.php
Created November 5, 2011 23:16
Plugin demonstrates how to route parent post/child post URLs WordPress 3.3
<?php
/**
* Plugin Name: MMC Parks and Features
* Description: This plugin demonstrates how to route parent/child URLs like http://example.com/parks/yosemite/half-dome/in WordPress 3.3
* Author: Mike Schinkel
* Author URL: http://about.me/mikeschinkel
* Notes:
* To answer http://lists.automattic.com/pipermail/wp-hackers/2011-November/041486.html
* Assumes a metabox that sets $post->post_parent field for a park feature with it's park's $post->ID.
*
@splorp
splorp / comment-blacklist-for-wordpress.md
Last active November 26, 2023 08:47
Comment Blacklist Keywords for WordPress

Comment Blacklist for WordPress

Notice!

As of November 5th, 2013, this version of the blacklist will no longer be updated.

I have migrated the project to a full Git repository in order to better track changes, bugs, and feedback.

Check out Comment Blacklist for WordPress on GitHub.