This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# shortform git commands | |
alias g='git' | |
# Restore deleted file from GIT repository | |
git checkout $(git rev-list -n 1 HEAD -- "$file")^ -- "$file" | |
# Remove .git dirs | |
find . -name ".git" -type d -exec rm -rf {} \; | |
# Top Ten of the most active committers in git repositories |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Enqueue scripts and styles | |
*/ | |
function version_id() { | |
if ( WP_DEBUG ) | |
return time(); | |
$my_theme = wp_get_theme(); | |
$thversion = $my_theme->Version; | |
return $thversion; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function cbqc_remove_boxes() { | |
// Remove boxes I don’t like | |
// *** For posts *** // | |
// Custom Fields | |
remove_meta_box( ‘postcustom’ , ‘post’ , ‘normal’ ); | |
// Excerpt | |
remove_meta_box( ‘postexcerpt’ , ‘post’ , ‘normal’ ); | |
// Trackbacks | |
remove_meta_box( ‘trackbacksdiv’ , ‘post’ , ‘normal’ ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add all custom post types to the "Right Now" box on the Dashboard | |
// CPTs auf der Startseite des Dashboards auflisten | |
add_action( 'right_now_content_table_end' , 'kh_right_now_content_table_end' ); | |
function kh_right_now_content_table_end() { | |
$args = array( | |
'public' => true , | |
'_builtin' => false | |
); | |
$output = 'object'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: MyWidget | |
Description: Description | |
Author: Pixolin | |
*/ | |
/******************** | |
* add a new Widget to WP_Widget class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'enable_post_format_ui', '__return_false' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function word_count() { | |
$content = get_post_field( 'post_content', $post->ID ); | |
$word_count = str_word_count( strip_tags( $content ) ); | |
return $word_count; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; pbcopy.el --- Emacs Interface to pbcopy | |
;; Copyright (C) 2011 Daniel Nelson, based on xclip.el, by Leo Shidai Liu | |
;; This file is free software; you can redistribute it and/or modify | |
;; it under the terms of the GNU General Public License as published by | |
;; the Free Software Foundation; either version 3, or (at your option) | |
;; any later version. | |
;; This file is distributed in the hope that it will be useful, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'preprocess_comment', 'minimal_comment_length' ); | |
function minimal_comment_length( $commentdata ) { | |
$minimalCommentLength = 20; | |
if ( strlen( trim( $commentdata['comment_content'] ) ) < $minimalCommentLength ) | |
{ | |
wp_die( 'All comments must be at least ' . $minimalCommentLength . ' characters long.' ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function templatedebug() { | |
global $template; $curtemplate=basename($template); | |
?> | |
<script type="text/javascript"> | |
console.log(<?php echo "\"current template: ".$curtemplate."\""; ?>); | |
</script> | |
<?php | |
} | |
add_action( 'wp_footer', 'templatedebug' ); |