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 / 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 / functions.php
Created September 15, 2011 13:31
WordPress: Change pagination_base
<?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 September 15, 2011 13:33
WordPress: Check if taxonomy is assigned to a post type
<?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 September 18, 2011 19:04
Breadcrumb Navigation for WordPress
<?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 April 11, 2024 13:54
CSS3 Box Shadow, only top/right/bottom/left and all
<!DOCTYPE html>
<html>
<head>
<title>Box Shadow</title>
<style>
.box {
height: 150px;
width: 300px;
margin: 20px;
@ocean90
ocean90 / debug.php
Created October 12, 2011 21:29
WordPress function to debug WordPress filters
<?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 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',