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
@franz-josef-kaiser
franz-josef-kaiser / MetaBoxOrder_Disable.php
Last active August 29, 2015 13:55
WordPress MetaBox Debug plugin - disables the user setting
<?php
namespace WCM;
/**
* Plugin Name: (WCM) Meta Box Order Debug
* Description: Temporarily overrides the MetaBox-order by dismissing the user setting.
* Author: Franz Josef Kaiser
* Author URI: https://unserkaiser.com
* Version: 1.0
## Comments added to deleted comments and answers, visible for the post author only.
Sorry, but this is not [an answer](http://wordpress.stackexchange.com/questions/how-to-answer).
[An answer should be more than just a link to an external site](http://wordpress.stackexchange.com/help/deleted-answers). Please add a solution.
[Ask a new question.](http://wordpress.stackexchange.com/questions/ask) Please don’t misuse the answer field for questions. Thanks.
[You must disclose your affiliation in your answers.](http://wordpress.stackexchange.com/help/behavior)
@franz-josef-kaiser
franz-josef-kaiser / .bashrc
Created February 5, 2014 19:11
Git/GNU Bash .bashrc file that contains most of the stuff that makes the CLI suck less.
# System-wide .bashrc file for interactive bash(1) shells.
# To enable the settings / commands in this file for login shells as well,
# this file has to be sourced in /etc/profile.
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
@franz-josef-kaiser
franz-josef-kaiser / disable_metabox_order.php
Last active August 29, 2015 13:56
WordPress plugin that temporarily disables the user defined order (user settings). The plugin is targeted at developers. Often it's annoying when you add a meta box to the admin UI and can't be sure if it's in the right position because you might have already moved it around and added a user setting. The plugin can be reused to temporarily overr…
<?php
namespace WCM;
/**
* Plugin Name: (WCM) Meta Box Order Debug
* Description: Temporarily overrides the MetaBox-order by dismissing the user setting.
* Author: Franz Josef Kaiser
* Author URI: https://unserkaiser.com
* Version: 1.0
@franz-josef-kaiser
franz-josef-kaiser / save.md
Last active August 29, 2015 13:57
Save Post meta data - basics

Assuming that you have a meta box on your post types post.php or post-new.php screen, that has a Nonce value

wp_nonce_field( $this->action, $this->nonce );

and another hidden field that holds the current blog ID

<!-- Retrieve the current blog ID to not save data to the wrong blog per accident. -->
<input type="hidden" name="blog_id" value="<?php print get_current_blog_id(); ?>">

Then you may end up with the following check:

@franz-josef-kaiser
franz-josef-kaiser / breadcrumb.navigation.php
Last active August 29, 2015 13:58 — forked from chipbennett/breadcrumb.navigation.php
This is a fork of Chip Bennets idea to implement breadcrumbs into WP Core. The code is procedural and really not the best - but it would fit into core much easier this way as when implementing it with real OOP patterns.
<?php
/**
* Add navigation breadcrumb
*/
function wp_nav_breadcrumb() {
// Separator between breadcrumb links
$delimiter = apply_filters( 'wp_nav_breadcrumb_delimiter', ' &raquo; ' );
// Show taxonomy crumbs for single posts
$show_tax_crumb_for_single = apply_filters( 'wp_nav_breadcrumb_show_tax_crumb_for_single', true );
@franz-josef-kaiser
franz-josef-kaiser / linklist.md
Created June 4, 2014 23:06
Open Knowledge Foundation Austria - Metalab 05.06.2014 - Preparation / Link list
@franz-josef-kaiser
franz-josef-kaiser / media_att_count.php
Last active August 29, 2015 14:03
WordPress plugin: Adds a column to the media admin list table to show the count of posts. Also adds a "size" column which displays the duration of Audio files or sizes of image files.
<?php
namespace WCM;
/**
* Plugin Name: (WCM) Media Count
* Description: Adds a column to the media admin list table to show the count of posts
* License: MIT
*/
@franz-josef-kaiser
franz-josef-kaiser / expendables4.md
Created August 4, 2014 23:14
Expandables 4 - Cast - the wish list