Skip to content

Instantly share code, notes, and snippets.

View sheabunge's full-sized avatar
😴

Shea Bunge sheabunge

😴
View GitHub Profile
@tommcfarlin
tommcfarlin / add-custom-post-type-menu.php
Created April 25, 2013 12:38
[WordPress] Add a custom post type menu as a child of an existing custom post type menu.
<?php
// Define the 'Portfolio' post type. This is used to represent galleries
// of photos. This will be our top-level custom post type menu
$args = array(
'labels' => array(
'all_items' => 'Gallery',
'menu_name' => 'Portfolio',
'singular_name' => 'Gallery',
'edit_item' => 'Edit Gallery',
@joncave
joncave / plugin.php
Last active September 21, 2023 17:50
An intentionally vulnerable plugin developed for WordPress plugin author education. http://make.wordpress.org/plugins/2013/04/09/intentionally-vulnerable-plugin/
<?php
/* Plugin Name: Damn Vulnerable WordPress Plugin
* Description: Intentionally vulnerable plugin for plugin author education
* Version: 0.1
* Plugin URI: http://make.wordpress.org/plugins/2013/04/09/intentionally-vulnerable-plugin/
* Author: Jon Cave
* Author URI: http://joncave.co.uk
* License: GPLv2+
*
* DO NOT RUN THIS PLUGIN ON AN INTERNET ACCESSIBLE SITE
@paulund
paulund / minimal-comment-character-limit.php
Created April 7, 2013 17:13
Set a minimal character comment limit in Wordpress.
<?php
add_filter( 'preprocess_comment', 'minimal_comment_length' );
function minimal_comment_length( $commentdata ) {
$minimalCommentLength = 20;
if ( strlen( trim( $commentdata['comment_content'] ) ) < $minimalCommentLength )
{
wp_die( 'All comments must be at least ' . $minimalCommentLength . ' characters long.' );
}
@sunnyratilal
sunnyratilal / EDD Function Example.php
Created April 4, 2013 09:15
Example Easy Digital Downloads Function
<?php
/**
* Example function description
*
* @since {Next EDD Version}
* @param {array, string, int, objext} {$variable_name} {Short description}
* @return {array, string, int, mixed, object} {$variable_name} {Short description}
* {@internal Any To-Dos etc.}
*/
@ocean90
ocean90 / svg.php
Created March 28, 2013 13:35
#WordPressPlugin: Allows you to upload SVG files through the media uploader.
<?php
/**
* Plugin Name: SVG
* Version: 1.0
* Description: Allows you to upload SVG files through the media uploader.
* Author: Dominik Schilling
* Author URI: http://wphelper.de/
* Plugin URI: https://gist.github.com/ocean90/5263152
*
* License: GPLv2 or later
@auscompgeek
auscompgeek / xkcd_download.py
Last active April 30, 2021 23:07
A forwards and backwards compatible xkcd downloader written in Python.
#!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""An xkcd downloader by auscompgeek.
This Python script will download all xkcd comics within the range specified.
Both Python 2.x and 3k are supported. Tested on Python 2.7.3 and 3.2.1.
@thefuxia
thefuxia / t5-new-comments-right-now.php
Created March 16, 2013 10:24
T5 New Comments In Right Now Dashboard
<?php # -*- coding: utf-8 -*-
/**
* Plugin Name: T5 New Comments In Right Now Dashboard
* Description: Show the number of new comments on the Right Now dashboard
* Plugin URI:
* Version: 2013.03.16
* Author: Thomas Scholz
* Author URI: http://toscho.de
* Licence: MIT
* License URI: http://opensource.org/licenses/MIT
@tommcfarlin
tommcfarlin / jquery-boilerplate.js
Created March 7, 2013 16:12
[WordPress] Properly loading jQuery within WordPress without having to use the `noConflict` method, or creating your own reference such as `$wp = jQuery`.
/**
* This gist demonstrates how to properly load jQuery within the context of WordPress-targeted JavaScript so that you don't
* have to worry about using things such as `noConflict` or creating your own reference to the jQuery function.
*
* @version 1.0
*/
(function( $ ) {
"use strict";
$(function() {
@brasofilo
brasofilo / press-this-thickbox.php
Last active December 10, 2015 20:48
Dealing with PressThis inside an administrative thickbox
<?php
/**
Auxiliary menu and page with a button to open the thickbox
*/
add_action('admin_menu', 'add_auxiliary_menu');
function add_auxiliary_menu()
{
add_menu_page(
'TB',
<?php
/*
Plugin Name: Disable plugins when doing local dev
Description: If the WP_LOCAL_DEV constant is true, disables plugins that you specify
Version: 0.1
License: GPL version 2 or any later version
Author: Mark Jaquith
Author URI: http://coveredwebservices.com/
*/