Skip to content

Instantly share code, notes, and snippets.

@thefuxia
thefuxia / t5-silent-flush.php
Last active August 11, 2016 11:03
T5 Silent Flush - Flushes rewrite rules whenever a custom post type or taxonomy is registered and not already part of these rules. This is a soft flush, the .htaccess will not be rewritten.
<?php # -*- coding: utf-8 -*-
/**
* Plugin Name: T5 Silent Flush
* Description: Flushes rewrite rules whenever a custom post type or taxonomy is registered and not already part of these rules. This is a soft flush, the .htaccess will not be rewritten.
* Version: 2013.05.04
* Author: Thomas Scholz <info@toscho.de>
* Author URI: http://toscho.de
* License: MIT
* License URI: http://www.opensource.org/licenses/mit-license.php
*/
@thefuxia
thefuxia / class.Wpse_Datepicker_Example.php
Last active July 19, 2020 05:06
WPSE Plugin Options Page
<?php
class Wpse_Datepicker_Example extends Wpse_Plugin_Options_Page
{
protected $title = 'jQuery Date Picker';
protected $menu_slug = 'wpse_datepicker';
protected $option = 'wpse_datepicker';
protected $scripts = array ( 'jquery-ui-datepicker' );
// not inherited
public static function get_instance()
@thefuxia
thefuxia / stop-plugin-upgrade.php
Created April 7, 2013 15:28
Stop Plugin Upgrade Notices
<?php # -*- coding: utf-8 -*-
/*
* Place the following code in the main plugin file (the one with the plugin
* headers) to stop upgrade notices for this plugin.
*/
if ( ! function_exists( 't5_no_upgrade_check' ) )
{
add_filter( 'http_request_args', 't5_no_upgrade_check', 5, 2 );
@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
@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-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
@thefuxia
thefuxia / language-list.php
Last active October 5, 2016 11:52
List of language codes and their names (native and English) * @source http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes * @Version 2013.03.14
<?php
/**
* List of language codes and their names (native and English)
*
* Usage:
* $languages = require_once "language-list.php";
*
* @source http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
* @version 2013.03.14
* @author Thomas Scholz <info@toscho.de>
@thefuxia
thefuxia / remove-tabindex.js
Created March 5, 2013 21:49
Userscript: Remove tabindex attributes Tested in Opera only.
// ==UserScript==
// @name Remove tabindex attributes
// @namespace remove-tabindex-toscho
// @description Removes all tabindex attributes
// @author Thomas Scholz
// ==/UserScript==
if ( tabFucked = document.querySelectorAll( "[tabindex]" ) ) {
for ( var i = 0, max = tabFucked.length; i < max; i++ ) {
if ( 0 != tabFucked[i].getAttribute( "tabindex" ) )
@thefuxia
thefuxia / t5-head-meta.php
Last active December 14, 2015 11:49
T5 Head Meta
<?php
/**
* Plugin Name: T5 Head Meta
* Description: Meta data for head element
* Plugin URI:
* Version: 2013.04.08
* Author: Thomas Scholz
* Author URI: http://toscho.de
* Licence: MIT
* License URI: http://opensource.org/licenses/MIT
@thefuxia
thefuxia / inspect-queries.php
Created February 27, 2013 13:17
T5 Inspect Queries Adds a list of all queries at the end of each file.
<?php
/**
* Plugin Name: T5 Inspect Queries
* Description: Adds a list of all queries at the end of each file.
*
* Add the following to your wp-config.php:
define( 'WP_DEBUG', TRUE );
define( 'SAVEQUERIES', TRUE );