Skip to content

Instantly share code, notes, and snippets.

@chrisguitarguy
chrisguitarguy / widget-tut.php
Created October 11, 2011 22:18
An example of how to build your own WordPress widget
<?php
/*
Plugin Name: PMG Widget Tututorial
Plugin URI: http://pmg.co/category/wordpress
Description: How to create WordPress Widgets.
Version: 1.0
Author: Christopher Davis
Author URI: http://pmg.co/people/chris
License: GPL2
*/
@bueltge
bueltge / widget-tut.php
Last active December 8, 2017 03:19 — forked from chrisguitarguy/widget-tut.php
An example of how to build your own WordPress widget
<?php
/*
Plugin Name: FB Widget Tutorial
Plugin URI:
Description: How to create WordPress Widgets.
Version: 13/03/2013
Author: Frank Bültge
Author URI: http://bueltge.de/
License: GPLv3
*/
@billerickson
billerickson / gist:1325314
Created October 30, 2011 00:54
Add rel=nofollow to categories
<?php
/**
* Add rel=nofollow to wp_list_categories
* @link http://www.billerickson.net/adding-nofollow-to-category-links/
* @author Bill Erickson
*/
function add_nofollow( $text ) {
$text = stripslashes($text);
$text = preg_replace_callback('|<a (.+?)>|i', 'wp_rel_nofollow_callback', $text);
@chrisguitarguy
chrisguitarguy / mask-links.php
Created December 14, 2011 14:38
Mask external WordPress links behind a redirect.
@chrisguitarguy
chrisguitarguy / fix-ssl.php
Created December 20, 2011 07:13
Allow the WordPress HTTP api to make requests to github (bypassing SSL issues due to host configuration)
<?php
/*
Plugin Name: Fix SSL for Github
Plugin URI: http://www.christopherguitar.net/
Description: Allow unverified SSL certificates from github only.
Author: Christopher Davis
Author URI: http://www.christopherguitar.net/
License: GPL2
*/
@dz0ny
dz0ny / intelligentPre-loading.js
Created December 25, 2011 21:19
Prefetch,prerender, preload HTML5 snippet for jQuery
// create an object named "app" which we can define methods on
var app = {
// returns an array of each url to prefetch
searchUniqueWithLimit: function(selector,limit){
// returns an array for selector
var hrefs = $(selector).map(function(index, domElement){
return $(this).attr("href");
});
// returns the array of hrefs without duplicates
return $.unique(hrefs).slice ( 0, limit?limit:5 );
@glueckpress
glueckpress / disable_self_ping.php
Created January 17, 2012 22:35
Disable self trackbacks from your own WordPress blog.
<?php
// Retrieved from: http://wp-snippets.com/disable-self-trackbacks/
add_action( 'pre_ping', 'disable_self_ping' );
function disable_self_ping( &$links ) {
foreach ( $links as $l => $link )
if ( 0 === strpos( $link, get_option( 'home' ) ) )
unset($links[$l]);
}
@bueltge
bueltge / remove_br_in_pre.php
Created January 23, 2012 15:03
Code to Question on WPSE questions 39843
<?php
/**
* Plugin Name: Remove br in pre
* Plugin URI: http://wordpress.stackexchange.com/questions/39843/no-filter-of-code-on-switch-from-html-to-visual-editor-how
* Text Domain:
* Domain Path: /languages
* Description:
* Version: beta
* Author: Frank Bültge
* Author URI: http://bueltge.de
@xeoncross
xeoncross / vpsinfo.php
Created January 26, 2012 21:22
general information/monitoring page for a Linux Virtuozza or OpenVZ VPS (Virtual Private Server)
<?php
// vpsinfo by Douglas Robbins
// Email: drobbins [at] labradordata.ca
// Website: http://www.labradordata.ca/home/13
$version = '2.3.2 (16 June 2006)';
// This script is intended as a general information/monitoring page for a Linux
// Virtuozza or OpenVZ VPS (Virtual Private Server). It also runs fine on a
// dedicated Linux machine.
@benhuson
benhuson / class-frontend.php
Created February 3, 2012 15:48
WordPress SEO plugin patch
<?php
class WPSEO_Frontend {
function __construct() {
$options = get_wpseo_options();
add_action( 'wp_head', array(&$this, 'head'), 1, 1 );
remove_action( 'wp_head', 'rel_canonical' );