Skip to content

Instantly share code, notes, and snippets.

View bueltge's full-sized avatar
Always interested

Frank Bültge bueltge

Always interested
View GitHub Profile
@bueltge
bueltge / gist:1619667
Created January 16, 2012 07:49
Navigating with jQuery Keyboard Shortcuts
( function ( $ ) {
$( document ).keydown( function( e ) {
var url = false;
if ( 37 == e.which ) { // Left arrow key code
url = $( '.prev a' ).attr( 'href' ); // set right class
}
else if ( 39 == e.which ) { // Right arrow key code
url = $( '.next a' ).attr( 'href' ); // set right class
}
@bueltge
bueltge / github-ribbon.html
Created January 27, 2012 10:23
Github Ribbon only with css3
<a id="github" href="https://github.com/bueltge">
<span>Fork me on GitHub!</span>
<span>Get free lemonade!</span>
</a>
@bueltge
bueltge / dabblet.css
Created February 8, 2012 11:24
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
body {
margin: 5em;
}
.tooltip {
font: normal 11px/17px sans-serif;
/* View and change on http://dabblet.com/gist/1787522
*/
body {
margin: 7em 3em;
}
button,
input,
select,
textarea {
@bueltge
bueltge / gist:2304293
Created April 4, 2012 18:01
Remove hierarchy on WordPress Category meta box
add_action( 'add_meta_boxes', 'do_my_meta_boxes' );
function do_my_meta_boxes( $post_type ) {
remove_meta_box( 'my_taxonomydiv', $post_type, 'side' );
add_meta_box( 'my_taxonomydiv', 'My Taxonomy', 'my_meta_box', $post_type, 'side' );
}
function my_meta_box( $post, $meta_box ) {
$taxonomy = 'my_taxonomy';
$tax = get_taxonomy( $taxonomy );
@bueltge
bueltge / gist:3121676
Created July 16, 2012 09:03
Filter WordPress date on tables in backend
// my custom field for the author is meta_key
// the field for table, filtering is my_author
$my_post_type = 'post';
add_filter( 'manage_edit-' . $my_post_type . '_columns', 'fb_add_columns' );
add_filter( 'manage_posts_custom_column', 'fb_return_custom_columns', 10, 3 );
add_filter( 'manage_edit-' . $my_post_type . '_sortable_columns', 'fb_sortable_columns' );
@bueltge
bueltge / wpse46583_save.php
Created August 1, 2012 13:30
Check for right WordPress page template on save_post hook
<?php
/**
* Plugin Name: Template Check
* Plugin URI: http://wordpress.stackexchange.com/questions/60451/check-for-page-template-on-save-post-hook/
* Description:
* Author: Frank Bültge
* Author URI: http://bueltge.de
* License: GPLv3
*/
@bueltge
bueltge / fix-custom-fields-in-wp342.php
Created September 7, 2012 14:43
Implements a workaround for adding and updating custom fields in WordPress 3.4.2
<?php
/**
* Plugin Name: Fix Custom Fields in WP 3.4.2
* Version: 0.0.1
* Plugin URI: http://core.trac.wordpress.org/ticket/21829
* Description: Implements a workaround for adding and updating custom fields in WordPress 3.4.2
* Author:
* Author URI:
*/
@bueltge
bueltge / mlp-addon-custom-wigdet.php
Last active October 18, 2015 17:04
MultilingualPress Add on as example to create a custom language switcher widget.
<?php # -*- coding: utf-8 -*-
/**
* Plugin Name: MultilingualPress Add on as example to create a custom language switcher widget.
* Description: This is a simple add-on for the MultilingualPress plugin to create a language switcher widget, that is only visible if there are relationship.
* Author: Inpsyde GmbH
* Author URI: http://inpsyde.com
* Version: 2015-10-19
* Text Domain: multilingualpressaddon
* Domain Path: /languages
* License: GPLv2+
@bueltge
bueltge / rem-fallback.scss
Created January 2, 2013 15:31
Fallback rem-mixin Sass, Compass
$main-font-size: 16px;
@mixin x-rem ($property, $value) {
#{$property}: $value * $main-font-size;
#{$property}: #{$value}rem;
}
.some-class {
@include x-rem(font-size, 1.4);