Skip to content

Instantly share code, notes, and snippets.

View derpixler's full-sized avatar

DerPixler derpixler

View GitHub Profile
@derpixler
derpixler / formaValidator.js
Created August 30, 2011 08:17
Ein Einfacher Formvalidator
/*
* Wegen der häufigen verwendung dieses Selctors Speichern wir
* den zu erst in eine Variable.
*
*/
var formular_input = $('#formular input');
/*
* In der Variable formular_input befindet sich ein Obejct
@derpixler
derpixler / post_submitbox_misc_actions.php
Created August 30, 2011 11:51
post_submitbox_misc_actions
add_action('post_submitbox_misc_actions','my_post_option');
add_action( 'save_post', 'save_my_post_option' );
function my_post_option( ){
echo '<div style="border-top:1px solid #DFDFDF;border-bottom:1px solid #FFF;clear:both;" id="post_anonym"><div style="padding: 6px 10px;float:left">';
echo ' Hallo WordPress';
echo '</div></div>';
}
function save_my_post_option( $post_id ) {
@derpixler
derpixler / easyseobox.php
Created September 5, 2011 14:25
Mach mir eine einfache Seo box
<?
#get_post_meta($post->ID, 'SeoHead', true)
$seo_box = 'H1 Headline: Keyword1, Keyword2, Keyword3, Keyword4, Keyword5';
$meta_values = explode(':',$seo_box);
if(isset($meta_values[1])){
$keywords = explode(',',$meta_values[1]);
$seo_box = '<ul>';
foreach($keywords as $keyword){
@derpixler
derpixler / wp-hooks-filter.php
Created October 4, 2011 08:37 — forked from bueltge/wp-hooks-filter.php
Instruments Hooks for a Page of WordPress. Outputs during the Shutdown Hook after add get-params: ?instrument=hooks
<?php
/*
Plugin Name: Instrument Hooks for WordPress
Plugin URI: http://bueltge.de/
Description: Instruments Hooks for a Page. Outputs during the Shutdown Hook after add get-params <code>?instrument=hooks</code>.
Version: 0.0.1
Author: Frank B&uuml;ltge
Author URI: http://bueltge.de/
*/
@derpixler
derpixler / my_userfields,php
Created October 26, 2011 19:51
creat new custom extra user profiel fields
function my_userfields(){
$output = '<h3>Meine Felder</h3>';
$output .= '<table class="form-table">';
if(isset($_GET['user_id'])){
$user_id = $_GET['user_id'];
}else{
$user_id = $_POST['user_id'];
}
@derpixler
derpixler / add_Linktitle.php
Created January 9, 2012 09:15
add Linktitle to Prev and Next Link
function add_rr_linktitle( $format, $link = FALSE ){
if( $link )
$nex_prev = true;
preg_match_all( '/<a href="(.*?)" rel="(.*?)">(.*?)<\/a>/', $format, $matches);
return '<a href="' . $matches[1][0] . '" rel="' . $matches[2][0] . '" title="' . get_adjacent_post( false, '', $nex_prev )->post_title . '">' . $matches[3][0] . '</a> ';
}
add_filter( 'previous_post_link', 'add_rr_linktitle', 9, 2 );
add_filter( 'next_post_link', 'add_rr_linktitle', 9, 1 );
@derpixler
derpixler / add_title_nexprev.php
Created January 10, 2012 11:04
Vergib Titel-Tag
<?php
/*
Module Name: Vergib Titel-Tag
Module URI: https://plus.google.com/u/0/116520935691953756105/posts/Bq1iaEzC9h1
Description: Titel-Tag für vorherige und folgende Seiten links
Author: René Reimann
Author URI: http://www.honeymilk.org
*/
@derpixler
derpixler / gist:1668876
Created January 24, 2012 08:33
puzzling Rewrite rule
<?php
function add_mypage_var($public_query_vars) {
$public_query_vars[] = 'blub_key';
return $public_query_vars;
}
function createRewriteRules() {
global $wp_rewrite;
@derpixler
derpixler / register_custom_post_types.php
Created January 25, 2012 16:03
register_custom_post_types
<?php
/**
* Meine Dokumentation zu der Funktion xyz die dafuer sorgt das XYZ etwas macht
*
* @autor Rene Reimann
* @package Theme XYZ
*/
if ( ! class_exists( 'register_custom_post_types' ) ) {
@derpixler
derpixler / gist:1730623
Created February 3, 2012 15:12
add form fields to custom taxonomy
<?php
function edit_category_form($tag){
$taxonomy = $tag->taxonomy ;
if( $taxonomy != 'category' ){
$taxonomy = 'custom_taxonomy';
}