Skip to content

Instantly share code, notes, and snippets.

View bueltge's full-sized avatar
Always interested

Frank Bültge bueltge

Always interested
View GitHub Profile
<?php
/**
* This class will cause WP_Query to ignore a 'post_type' parameter when 'post_type__not_in' is set.
*
* Class Post_Type__Not_In
*/
class Post_Type__Not_In {
/**
*
@bueltge
bueltge / mlp-filter-site.php
Last active September 16, 2015 07:17
MultilingualPress Add on to filter non public sites.
<?php # -*- coding: utf-8 -*-
/**
* Plugin Name: MultilingualPress Add on to hide Non-public Sites
* Description: This is a simple add-on for the MultilingualPress plugin to hide non-public sites (i.e., languages) from translation lists such as the Language Switcher widget or the Quicklinks.
* Author: Inpsyde GmbH
* Author URI: http://inpsyde.com
* Version: 2015-09-16
* License: GPLv2+
* Network: true
*/
@bueltge
bueltge / comments.php
Created May 3, 2011 17:39
iNove Theme
<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/comment.js"></script>
<?php if (!empty($post->post_password) && $_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) : ?>
<div class="errorbox">
<?php _e('Enter your password to view comments.', 'inove'); ?>
</div>
<?php return; endif; ?>
<?php
$options = get_option('inove_options');
@bueltge
bueltge / gist:1038032
Created June 21, 2011 15:00
Transition form bw 2 color with canvas
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>untitled</title>
<style>
/* Setup...not important. */
.img-wrap {
width: 500px;
@bueltge
bueltge / gist:1119722
Created August 2, 2011 07:03
Debug Shortcodes
function fb_show_shortcodes( $atts, $content = NULL ) {
extract( shortcode_atts(
array('linebreak'=>''),
$atts
) );
$brackets = array();
$brackets[0] = "/\[/";
$brackets[1] = "/\]/";
@bueltge
bueltge / gist:1155369
Created August 18, 2011 22:06
has_shortcode()
// check the current post for the existence of a short code
function has_shortcode( $shortcode = NULL ) {
$post_to_check = get_post( get_the_ID() );
// false because we have to search through the post content first
$found = false;
// if no short code was provided, return false
if ( ! $shortcode ) {
@bueltge
bueltge / gist:1168439
Created August 24, 2011 16:19
Adds classes for custom taxonomies to body_class()
function fb_add_body_class( $class ) {
if ( ! is_tax() )
return $class;
$tax = get_query_var( 'taxonomy' );
$term = $tax . '-' . get_query_var( 'term' );
$class = array_merge( $classes, array( 'taxonomy-archive', $tax, $term ) );
return $class;
@bueltge
bueltge / get_ram_in_footer.php
Last active September 27, 2015 03:28
WordPress Plugin to list used and standing ready RAM and SQL Queries in Admin-Footer
@bueltge
bueltge / gist:1218587
Created September 15, 2011 05:03
Add WordPress post thumbnail to feed
// show post thumbnails in feeds
function fb_post_thumbnail_2_feeds( $content ) {
if ( has_post_thumbnail( get_the_ID() ) )
$content = '<div>' . get_the_post_thumbnail( get_the_ID() ) . '</div>' . $content;
return $content;
}
add_filter( 'the_excerpt_rss', 'fb_post_thumbnail_2_feeds' );
add_filter( 'the_content_feed', 'fb_post_thumbnail_2_feeds' );
@bueltge
bueltge / gist:1242366
Created September 26, 2011 14:30
How to use AJAX with WordPress to post and process Javascript
<?php
/*
* Example of how to use AJAX with WordPress to post and process Javascript arrays of objects.
* Drop this in your WordPress theme's functions.php file and it will display the array of objects on page load in the admin
* REF: http://lists.automattic.com/pipermail/wp-hackers/2011-September/040834.html
* By: Mike Schinkel - http://about.me/mikeschinkel
*/
add_action( 'admin_init', 'mytheme_admin_init' );
function mytheme_admin_init() {
wp_enqueue_script('jquery');