Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View ocean90's full-sized avatar
🌊
Surfing the open source wave

Dominik Schilling ocean90

🌊
Surfing the open source wave
View GitHub Profile
@ocean90
ocean90 / 29026.patch
Last active August 29, 2015 14:04
wp.media.view.Label
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 August 29, 2015 14:08
Customizer Tickets for 4.1

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.
@ocean90
ocean90 / Default (OSX).sublime-keymap
Created December 14, 2014 14:56
Sublime Text 3 Config
[
{ "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" }
]
<?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 August 29, 2015 14:24
Saves outgoing mails in a post type, drop it into wp-content/mu-plugins.
<?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 September 14, 2011 20:28
Extend post_class with a class for parent category
<?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 September 15, 2011 13:29
Load Google+ button with jQuery AJAX
( 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 November 18, 2011 17:42
Drop existing WP install and install a new clean WP
<?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 November 28, 2011 18:47
WP Editor: Scroll to old position after saving or updating a post
<?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 December 1, 2011 10:25
Fix Debug Bar item in WordPress 3.3
<?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',