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 / emoji-removel.php
Last active March 25, 2019 08:16
Remove the Emoji Support in WordPress. #performance
<?php declare(strict_types=1);
/**
* Plugin Name: Emoji Removel.
* Description: Remove all Emoji support to laod faster on back - and front-end.
*/
add_action(
'init',
function () {
remove_action('wp_head', 'print_emoji_detection_script', 7);
@bueltge
bueltge / gist:5a3545ada7e68d367424
Last active January 31, 2019 17:53
Prevent/Disable Automatic Theme Update Check for comment on WPSE
// More background
// @see http://wordpress.stackexchange.com/questions/102554
add_filter( 'http_request_args', 'fb_hidden_theme_12345', 5, 2 );
function fb_hidden_theme_12345( $r, $url ) {
if ( FALSE !== strpos( $url, 'https://api.wordpress.org/themes/update-check' ) )
return $r; // Not a theme update request. Bail immediately.
@bueltge
bueltge / gist:1016758
Created June 9, 2011 13:46
Add Admin-User in WordPress via mySQL
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');
@bueltge
bueltge / commentmeta-multi.php
Created May 3, 2011 11:38
WordPress Example Plugin: Comment meta data test
<?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 / gist:1016587
Created June 9, 2011 11:58
Include custom taxonomy term in WordPress search
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:1019737
Created June 10, 2011 20:44
"view Source" Marker
HTML:
<a lass="viewsource" title="view Source of this page" href="http://example.org/viewsource/?url=http://example.org/">view source</a>
JS, jQuery Plugin:
http://swip.codylindley.com/DOMWindowDemo.html
inline JS:
<script type="text/javascript">
$('.viewsource').openDOMWindow({
height:'90%',
@bueltge
bueltge / gist:1058115
Created July 1, 2011 08:48
Google+ Button "Likes" auslesen
function get_google_plus1_count($url)
{
$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_HTTPHEADER => array('Content-type: application/json'),
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => '[{"method":"pos.plusones.get","id":"p","params":{"nolog":true,"id":"'.$url.'","source":"widget","userId":"@viewer","groupId":"@self"},"jsonrpc":"2.0","key":"p","apiVersion":"v1"}]',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_URL => 'https://clients6.google.com/rpc?key=AIzaSyCKSbrvQasunBoV16zDH9R33D88CeLr9gQ'
@bueltge
bueltge / gist:1259892
Created October 3, 2011 18:46
Widget Basis
<?php
/**
* Widget
* @author
* @package
*/
// TODO: change 'Fb_Wp_Widget_Basis' to the name of your actual plugin
class Fb_Wp_Widget_Basis extends WP_Widget {
@bueltge
bueltge / responsive-images.php
Created September 27, 2011 17:03 — forked from mattwiebe/responsive-images.php
Mobile First Responsive Images for WordPress
<?php
/*
Plugin Name: Mobile First Responsive Images
Description: Serve up smaller images to smaller screens.
Version: 0.1.1
Author: Matt Wiebe
Author URI: http://somadesign.ca/
*/
/**
@bueltge
bueltge / remove_br_in_pre.php
Created January 23, 2012 15:03
Code to Question on WPSE questions 39843
<?php
/**
* Plugin Name: Remove br in pre
* Plugin URI: http://wordpress.stackexchange.com/questions/39843/no-filter-of-code-on-switch-from-html-to-visual-editor-how
* Text Domain:
* Domain Path: /languages
* Description:
* Version: beta
* Author: Frank Bültge
* Author URI: http://bueltge.de