Skip to content

Instantly share code, notes, and snippets.

Avatar
🌊
Surfing the open source wave

Dominik Schilling ocean90

🌊
Surfing the open source wave
View GitHub Profile
@ocean90
ocean90 / 29026.patch
Last active Aug 29, 2015
wp.media.view.Label
View 29026.patch
Index: src/wp-includes/js/media-views.js
===================================================================
--- src/wp-includes/js/media-views.js (revision 29312)
+++ src/wp-includes/js/media-views.js (working copy)
@@ -5508,6 +5508,8 @@
this.createFilters();
_.extend( this.filters, this.options.filters );
+ this.createLabel();
+
@ocean90
ocean90 / gist:59cae91cf950ebd6c33c
Last active Aug 29, 2015
Customizer Tickets for 4.1
View gist:59cae91cf950ebd6c33c

4.1 Enhancements

Query

  • #21627 Filter for custom-background CSS selector [punt, use case is rare]
  • #29949 Customizer collapsed mode is barely usable [punt, mobile first]
  • #28650 Allow Customizer elements (controls, sections, and panels) to be deep-linked [needs-patch, margin bug]
  • #28542 Navigating within Customizer preview should update parent document title [commit 28542.2.diff]
  • #28504 Icons for Customizer Sections [punt, mobile first]
  • #28032 Headers, Backgrounds, and Widgets in the Customizer are not discoverable from their separate admin screens.
View Default (OSX).sublime-keymap
[
{ "keys": ["ctrl+super+l"], "command": "sublimelinter_lint" },
{ "keys": ["ctrl+super+e"], "command": "sublimelinter_goto_error", "args": {"direction": "next"} },
{ "keys": ["ctrl+super+shift+e"], "command": "sublimelinter_goto_error", "args": {"direction": "previous"} },
{ "keys": ["ctrl+super+b"], "command": "sublimelinter_show_all_errors" },
{ "keys": ["super+ctrl+a"], "command": "alignment" },
// swap the keybindings for paste and paste_and_indent
{ "keys": ["super+v"], "command": "paste_and_indent" },
{ "keys": ["super+shift+v"], "command": "paste" }
]
View rosetta-forums.php
<?php
function wporg_forums_add_administrator_role( $bbp_roles ) {
$bbp_roles['wporg_forums_admin'] = array(
'name' => __( 'Forums Administrator', 'wporg' ),
'capabilities' => bbp_get_caps_for_role( 'wporg_forums_admin' )
);
return $bbp_roles;
}
add_filter( 'bbp_get_dynamic_roles', 'wporg_forums_add_administrator_role', 1 );
@ocean90
ocean90 / debug-mail.php
Last active Aug 29, 2015
Saves outgoing mails in a post type, drop it into wp-content/mu-plugins.
View debug-mail.php
<?php
/**
* Plugin Name: Debug Mails
* Description: Saves outgoing mails in a post type.
* Author: Dominik Schilling (ocean90)
*/
function ds_register_cpt_mail_debug() {
register_post_type( 'mail-debug', array(
'label' => 'Mails',
@ocean90
ocean90 / functions.php
Created Sep 14, 2011
Extend post_class with a class for parent category
View functions.php
<?php
/**
* Erweitert post_class() um eine Klasse für Elternkategorien.
*
* @author Dominik Schilling
* @license GPLv2
* @link http://wpgrafie.de/178/
*
* @version 0.2
*/
@ocean90
ocean90 / jquery.plusone.js
Created Sep 15, 2011
Load Google+ button with jQuery AJAX
View jquery.plusone.js
( function( $ ) {
$( document ).ready( function() {
// Skript wird nur geladen, wenn ein Artikel in der Einzelansicht angezeigt wird.
if ( $( 'body.single' ).length ) {
$.ajax( {
type: 'GET',
url: 'https://apis.google.com/js/plusone.js', // Link zur plusone.js Datei.
timeout: 1000, // Passiert innerhalb von 1000ms nichts, wird der Ladevorgang abgebrochen.
dataType: 'script',
cache: true, // Javascript Datei cachen lassen.
@ocean90
ocean90 / newinstall.php
Created Nov 18, 2011
Drop existing WP install and install a new clean WP
View newinstall.php
<?php
/* Place the file into WordPress root folder and open the file in your browser. */
/* Settings */
define( 'BLOG_TITLE', 'WordPress Dev' );
define( 'USER_NAME', 'admin' );
define( 'USER_EMAIL', 'foobar@example.com' );
define( 'USER_PASSWORD', '123456' );
define( 'WP_SITEURL', 'http://wp.dev' );
@ocean90
ocean90 / scrollback.php
Created Nov 28, 2011
WP Editor: Scroll to old position after saving or updating a post
View scrollback.php
<?php
/**
* Adds a hidden input field for scrolltop value.
*
* @return void
*/
function ds_scrollto_input() {
$position = ! empty( $_GET['scrollto'] ) ? $_GET['scrollto'] : 0;
printf( '<input type="hidden" id="scrollto" name="scrollto" value="%d"/>', esc_attr( $position ) );
@ocean90
ocean90 / fixit.php
Created Dec 1, 2011
Fix Debug Bar item in WordPress 3.3
View fixit.php
<?php
// See http://wordpress.org/extend/plugins/debug-bar/
remove_action( 'admin_bar_menu', array( 'Debug_Bar', 'admin_bar_menu' ), 1000 );
add_action( 'admin_bar_menu', 'ds_fix_debug_bar_menu', 5 );
function ds_fix_debug_bar_menu( $wp_admin_bar ) {
$wp_admin_bar->add_menu( array(
'parent' => 'top-secondary',
'id' => 'debug-bar',