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 / fb_deactivate_oembed.php
Created January 2, 2013 20:30
Deactivate oembed in WordPress 3.5 and earlier
<?php
/**
* Plugin Name: Deactivate oEmbed
* Description: Deactivate oEmbed in WordPress 3.5 and earlier
* Version: 0.0.1
* Author: Frank Bültge
* Author URI: http://bueltge.de/
*/
remove_filter( 'the_content', array( $GLOBALS['wp_embed'], 'autoembed' ), 8 );
// path/to/theme/tinymce/en.js
// plugin.jsと同じディレクトリに設置
tinyMCE.addI18n("en.test_plugin",{
test_listbox : "Test listbox",
test_button : "Test button",
});
@bueltge
bueltge / How to
Last active December 18, 2015 00:29
Wrapper class to use sessions with WordPress
When I want to store some session data with the wrapper class, such as when a customer adds an item to the shopping cart, I simply do this:
```php
$cart = array(
array(
'item_id' => 43,
'item_name' => 'My Product Name'
),
array(
<?php
/* Register custom post types on the 'init' hook. */
add_action( 'init', 'my_register_post_types' );
/**
* Registers post types needed by the plugin.
*
* @since 0.1.0
* @access public
@bueltge
bueltge / deploy.sh
Created January 23, 2014 15:15 — forked from BFTrick/deploy.sh
#! /bin/bash
# A modification of Dean Clatworthy's deploy script as found here: https://github.com/deanc/wordpress-plugin-git-svn
# The difference is that this script lives in the plugin's git repo & doesn't require an existing SVN repo.
# main config
PLUGINSLUG="______your-plugin-name______"
CURRENTDIR=`pwd`
MAINFILE="______your-plugin-name______.php" # this should be the name of your main php file in the wordpress plugin
# git config
@bueltge
bueltge / metabox-register.php
Last active April 21, 2016 13:57
WordPress Antipattern, no good classes
// @see http://dnaber.de/blog/2015/wordpress-antipattern-filter-im-constructor-zuweisen/
class MetaBoxRegistrar {
private $metaBox;
public function __construct( MetaBoxInterface $metaBox ) {
$this->metaBox = $metaBox;
}
@bueltge
bueltge / clipboard.js
Created May 13, 2016 09:44
clipboard.js
//@see http://blog.codeinside.eu/2016/05/12/copy-to-clipboard-with-javascript
function detectIE() {
var ua = window.navigator.userAgent;
var msie = ua.indexOf('MSIE ');
if (msie > 0) {
// IE 10 or older => return version number
return parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10);
}
@bueltge
bueltge / Submit Event
Created March 28, 2011 14:15
Submit Event in Frontend of Blog via Template in Theme for Plugin: EVENTS MANAGER EXTENDED
<?php
/*
Template Name: Submit Event
Author: Frank Bueltge
Author URI: http://bueltge.de/
*/
function add_errormessage_style() { ?>
<style type="text/css">
.errormessage { border: 3px solid red; padding: 5px; color: #000; }
@bueltge
bueltge / keybase.md
Last active August 18, 2016 19:39
keybase.md

Keybase proof

I hereby claim:

  • I am bueltge on github.
  • I am bueltge (https://keybase.io/bueltge) on keybase.
  • I have a public key whose fingerprint is 5EA5 319F D531 1C84 7094 2FE4 1A56 7625 5969 6D2D

To claim this, I am signing this object:

@bueltge
bueltge / .bashrc
Last active September 7, 2016 14:16
Use Solarized colors on Gnome terminal with colorized support for git branches SEE the Steps on the first line inside the files for the right order of doing! 1. Copy and paste the following directly into your terminal and the color scheme will be updated instantly. 2. Install the correct dircolors + set to autoload 3. Copy my .bashrc or add to y…
# Step 3.
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines in the history. See bash(1) for more options