Skip to content

Instantly share code, notes, and snippets.

@thefuxia
thefuxia / autohook-usage-example.php
Created January 18, 2012 07:11
T5_Autohook Plugin
<?php # -*- coding: utf-8 -*-
declare( encoding = 'UTF-8' );
class Autohook_Demo
{
public static function init()
{
new self;
}
@PeteMall
PeteMall / plugin-last-updated.php
Created June 19, 2012 20:00
Display the last updated date for all plugins from the WordPress.org plugins repo.
<?php
/*
Plugin Name: Plugin Last Updated
Version: 1.0
License: GPL
Author: Pete Mall, Range
Author URI: http://petemall.com/
Description: Display the last updated date for all plugins from the <a href="http://wordpress.org/extend/plugins/">WordPress.org plugins repo</a>.
*/
@tott
tott / gist:3496266
Created August 28, 2012 08:42
enforce http
<?php
add_action( 'plugins_loaded', 'bypass_wp_login_for_pw_protected_posts' );
function bypass_wp_login_for_pw_protected_posts() {
// this functionality is a fork of http://core.trac.wordpress.org/browser/trunk/wp-login.php#L385
// keep this in sync with Core
$action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'login';
if ( 'postpass' <> $action )
return;
@thefuxia
thefuxia / t5-attachment-extras.php
Created September 6, 2012 13:15
T5 Attachment Extras
<?php # -*- coding: utf-8 -*-
/**
* Plugin Name: T5 Attachment Extras
* Description: Adds attachment ID and link to parent post to the attachment screen.
* Plugin URI: http://toscho.de/?p=2260
* Version: 2012.09.06
* Author: Thomas Scholz <info@toscho.de>
* Author URI: http://toscho.de
* License: MIT
* License URI: http://www.opensource.org/licenses/mit-license.php
@franz-josef-kaiser
franz-josef-kaiser / dashboard_widget_recently_edited_files.php
Last active December 10, 2015 01:48
Show the last X recently edited files in a dashboard widget
<?php
defined( 'ABSPATH' ) OR exit;
/**
* Plugin Name: (#64910) (Dashboard Widget) Last edited files
* Description: Lists the last edited files in a dashboard widget
* Author: Franz Josef Kaiser <wecodemore@gmail.com>
* Author URL: https://plus.google.com/107110219316412982437
* License: MIT
*/
@thefuxia
thefuxia / t5-table-size-dashboard-widget.php
Last active December 10, 2015 17:58
T5 Table size dashboard widget Print a list of table sizes into your dashboard.
<?php
/**
* Plugin Name: T5 Table size dashboard widget
* Description: Print a list of table sizes into your dashboard.
* Plugin URI:
* Version: 2013.01.07
* Author: Thomas Scholz
* Author URI: http://toscho.de
* Licence: MIT
* License URI: http://opensource.org/licenses/MIT
@franz-josef-kaiser
franz-josef-kaiser / wpse67107_restrict_upload.php
Created February 26, 2013 10:39
Restrict the maximum file size as well as the maximum allowed resolution for images uploaded to WordPress.
<?php
/**
* Plugin Name: (#67107) »kaiser« Restrict file upload via image dimensions
*/
function wpse67107_restrict_upload( $file )
{
$file_data = getimagesize( $file );
// Abort when we can't get any info:
if ( ! $file_data )
@franz-josef-kaiser
franz-josef-kaiser / debug_register_pt_args.class.php
Last active December 14, 2015 10:18
Shows the arguments of a newly registered post type right after it was registered. Helps inspecting which defaults have been added by core and if one of the developers arguments got overwritten. Simply add `&debug_pt_args=true` to your URL and set `WP_DEBUG` to `TRUE`.
<?php
defined( 'ABSPATH' ) OR exit;
/**
* Plugin Name: (WCM) Debug Register Post Type Args
* Description: Shows the arguments of a newly registered post type right after it was
* registered. Helps inspecting which defaults have been added by core and if
* one of the developers arguments got overwritten. Simply add
* <code>&debug_pt_args=true</code> to your URL and set
* <code>WP_DEBUG</code> to <code>TRUE</code> in your <code>wp-config.php</code>.
* Plugin URl: http://wordpress.stackexchange.com/questions/89066
@thefuxia
thefuxia / functions.php
Created March 18, 2013 09:49
Count posts in post-format "status".
add_action( 'wp_footer', 'count_statuses' );
function count_statuses()
{
$status = 'status';
$num = get_term_post_count_by_type( "post-format-$status", 'post_format' );
print "<pre>{$status}es: $num</pre>";
}
/**
* Count all post in a term.
@thefuxia
thefuxia / t5-spam-block.php
Last active December 15, 2015 12:09
T5 Spam Block Stop comments based on a block list before they can enter the database.
<?php # -*- coding: utf-8 -*-
/**
* Plugin Name: T5 Spam Block
* Description: Block spam before it reaches the database.
* Plugin URI: https://github.com/toscho/T5-Spam-Block
* Version: 2013.03.31
* Author: Thomas Scholz
* Author URI: http://toscho.de
* Licence: MIT
* License URI: http://opensource.org/licenses/MIT