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
@bueltge
bueltge / gist:757903
Created December 28, 2010 23:27
This WordPress Plugin demonstrates how you can build your own plugin pages using the WordPress provided draggable metaboxes, requires WordPress 2.7 version, supports WordPress 2.8 changed boxing layout engine
View gist:757903
<?php
/*
Plugin Name: HowTo Plugin
Plugin URI:
Description: This Plugin demonstrates how you can build your own plugin pages using the WordPress provided draggable metaboxes, requires WordPress 2.7 version, supports WordPress 2.8 changed boxing layout engine
Author: Heiko, Frank
Author URI: http://bueltge.de
Version: 0.1
License:
@bueltge
bueltge / Submit Event
Created March 28, 2011 14:15
Submit Event in Frontend of Blog via Template in Theme for Plugin: EVENTS MANAGER EXTENDED
View Submit Event
<?php
/*
Template Name: Submit Event
Author: Frank Bueltge
Author URI: http://bueltge.de/
*/
function add_errormessage_style() { ?>
<style type="text/css">
.errormessage { border: 3px solid red; padding: 5px; color: #000; }
@bueltge
bueltge / commentmeta-single.php
Created May 3, 2011 11:35
WordPress Example Plugin: Comment meta data test
View commentmeta-single.php
<?php
/*
Plugin Name: Comment meta data test
Version: 1.0
Plugin URI: http://wpengineer.com
Description: Comment meta data test
Author: Latz
Author URI: http://wpengineer.com
*/
@bueltge
bueltge / commentmeta-multi.php
Created May 3, 2011 11:38
WordPress Example Plugin: Comment meta data test
View commentmeta-multi.php
<?php
/*
Plugin Name: Comment meta data test
Version: 1.0
Plugin URI: http://wpengineer.com
Description: Comment meta data test
Author: Latz
Author URI: http://wpengineer.com
*/
@bueltge
bueltge / comments.php
Created May 3, 2011 17:39
iNove Theme
View comments.php
<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:998531
Created May 30, 2011 07:00
Example for add a Custom Post Type to the WordPress Post Feed
View gist:998531
add_action( 'request', array( &$this, 'add_to_feed' ) );
// add to post-feed
function add_to_feed($request) {
if ( isset($request['feed']) && !isset($request['post_type']) ) {
$request['post_type'] = get_post_types( $args = array(
'public' => true,
'capability_type' => 'post'
) );
@bueltge
bueltge / gist:998648
Created May 30, 2011 09:25
Example for add a Custom Post Type to the WordPress Loop
View gist:998648
// add custom post type to wp loop
add_action( 'pre_get_posts', 'add_to_query' );
// ads to query
function add_to_query( $query ) {
if ( is_admin() || is_preview() )
return;
// only filter on front page
@bueltge
bueltge / wp-hooks-filter.php
Created May 31, 2011 08:07
Instruments Hooks for a Page of WordPress. Outputs during the Shutdown Hook after add get-params: ?instrument=hooks
View wp-hooks-filter.php
<?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/
*/
@bueltge
bueltge / gist:1016587
Created June 9, 2011 11:58
Include custom taxonomy term in WordPress search
View gist:1016587
via http://wordpress.stackexchange.com/questions/2623/include-custom-taxonomy-term-in-search/5404#5404
function atom_search_where($where){
global $wpdb;
if ( is_search() )
$where .= "OR (t.name LIKE '%".get_search_query() . "%' AND {$wpdb->posts} . post_status = 'publish')";
return $where;
}
@bueltge
bueltge / gist:1016758
Created June 9, 2011 13:46
Add Admin-User in WordPress via mySQL
View gist:1016758
INSERT INTO `databasename`.`wp_users` (`ID`, `user_login`, `user_pass`, `user_nicename`, `user_email`, `user_url`, `user_registered`, `user_activation_key`, `user_status`, `display_name`) VALUES ('99', 'my_login_name', MD5('my_password'), 'My Name', 'mail@example.com', '', '2011-06-09 00:00:00', '', '0', 'display_name');
INSERT INTO `databasename`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '99', 'wp_capabilities', 'a:1:{s:13:"administrator";b:1;}');
INSERT INTO `databasename`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '99', 'wp_user_level', '10');