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 / 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 / functions.php
Created Sep 15, 2011
WordPress: Change pagination_base
View functions.php
<?php
/**
* Setzt die Seitenbasis für die Permalinkgenerierung auf /seite/ (Standard: /page/).
*
* @author Dominik Schilling
* @license GPLv2
* @link http://wpgrafie.de/141/
*
* @version 0.1
*/
@ocean90
ocean90 / archive.php
Created Sep 15, 2011
WordPress: Check if taxonomy is assigned to a post type
View archive.php
<?php
if ( ds_is_taxonomy_assigned_to_post_type( 'schnipsel' ) )
echo '<h3>Schnipsel Archiv</h3>';
else
echo '<h3>Archiv</h3>';
@ocean90
ocean90 / class-wordpress-breadcrumb.php
Created Sep 18, 2011
Breadcrumb Navigation for WordPress
View class-wordpress-breadcrumb.php
<?php
/**
* Klasse zum Erstellen einer WordPress Breadcrumb Navigation.
*
* @author Dominik Schilling
* @license GPLv2
* @link http://wpgrafie.de/204/
*
* @version 0.1.1
*/
@ocean90
ocean90 / box-shadow.html
Last active Nov 27, 2021
CSS3 Box Shadow, only top/right/bottom/left and all
View box-shadow.html
<!DOCTYPE html>
<html>
<head>
<title>Box Shadow</title>
<style>
.box {
height: 150px;
width: 300px;
margin: 20px;
@ocean90
ocean90 / debug.php
Created Oct 12, 2011
WordPress function to debug WordPress filters
View debug.php
<?php
/**
* Debug WordPress filters.
*
* Use add_action( 'shutdown', 'ds_debug_filters' ) to display all used
* filters with the functions hooked into the filter.
*
* @author Dominik Schilling
* @license GPLv2
* @link http://wpgrafie.de/262/
@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',