Skip to content

Instantly share code, notes, and snippets.

View franz-josef-kaiser's full-sized avatar

Franz Josef Kaiser franz-josef-kaiser

View GitHub Profile
/* TABLE OF CONTENTS
-----------------------------
- Sizes
- Borders
- Colors
- Typo
- Icons
*/
/* SIZES
@franz-josef-kaiser
franz-josef-kaiser / inspect_hooks.php
Created March 29, 2012 13:34
Inspect hooks in WP by adding &debug=true&hook=my_hook_name to the request URl
<?php
/**
* Plugin Name: Hook Debug Output
* Plugin URI: http://unserkaiser.com
* Description: Debug Hooked filter callback functions with adding <code>?debug=secret&hook=your_hook_name</code> to the URl
* Version: 0.1
* Author: Stephen Harris, Franz Josef Kaiser
* Author URI: http://unserkaiser.com
*/
// Prevent loading this file directly - Busted!
@franz-josef-kaiser
franz-josef-kaiser / hide_admin_bar.php
Created March 29, 2012 13:52
Hide the admin bar with the click of a button in the WP admin UI
<?php
/**
* Plugin Name: "Hide Admin Bar"-Button
* Plugin URI: http://unserkaiser.com
* Description: Easier debugging when the error message is hidden behind the admin bar.
* Version: 0.1
* Author: Franz Josef Kaiser
* Author URI: http://unserkaiser.com
*/
// Prevent loading this file directly - Busted!
@franz-josef-kaiser
franz-josef-kaiser / delay_publish.php
Created March 29, 2012 14:52
Delay the ability to publish posts
<?php
/**
* Plugin Name: Delay post publishing
* Plugin URI: http://unserkaiser.com
* Description: Only allows publishing a post if the user registered one week ago.
* Version: 0.1
* Author: Franz Josef Kaiser
* Author URI: http://unserkaiser.com
*/
// Not a WordPress context? Stop. Why? Ask @toscho
@franz-josef-kaiser
franz-josef-kaiser / test.php
Created April 2, 2012 19:43
Github Style example
<?php
$some_var = 'test';
// With inline var:
echo "{$some_var}-with_trailing_text.png";
// With prepended var:
echo $some_var.'-with_trailing_text.png';
@franz-josef-kaiser
franz-josef-kaiser / example_post_status.php
Created June 14, 2012 13:07
Add a custom post status for WP (custom) post types
<?php
// No, Thanks. Direct file access forbidden.
! defined( 'ABSPATH' ) AND exit;
// INIT
add_action( 'after_setup_theme', array( 'unavailable_post_status', 'init' ) );
class unavailable_post_status extends wp_custom_post_status
{
/**
@franz-josef-kaiser
franz-josef-kaiser / get_remote_plugin_header.php
Created June 29, 2012 20:03
Retrieve plugin header comment from GitHub hosted plugin file
<?php
/**
* Get version number from main remote file plugin header comment
*
* @param string $raw_url The path to the plugin @example http://raw.github.com/franz-josef-kaiser/example
* @param string $main_file The main plugin file containing the plugin header comment
* @return mixed string|bool $all_headers FALSE on failure, ARRAY w plugin header comment data on success
*/
public function get_remote_plugin_data( $raw_url, $main_file )
{
@franz-josef-kaiser
franz-josef-kaiser / lang_change_button.md
Last active October 6, 2015 22:57
Change the language by the click of a button (link in the admin bar).
@franz-josef-kaiser
franz-josef-kaiser / current_admin_info.php
Created September 13, 2012 01:25
Collect & display data from current admin screens contextual hooks and from which hook on some globals are available.
MOVED TO A REPO NOW: https://github.com/franz-josef-kaiser/current-admin-info
@franz-josef-kaiser
franz-josef-kaiser / example_post_att.php
Created October 5, 2012 09:33
Example object for a WP_Post_Attachment class output
// @link http://core.trac.wordpress.org/ticket/16349
stdClass::__set_state(array(
'attachment_id' => 15,
'rel' => 'internal',
'in_network' => true,
'object_types' =>
array (
'post' =>
array (