Skip to content

Instantly share code, notes, and snippets.

View remkus's full-sized avatar

Remkus de Vries remkus

View GitHub Profile
@ramseyp
ramseyp / character-cleanup.sql
Created July 5, 2012 17:00
Clean up malformed characters in WordPress database
## Run this in phpMyadmin
##
## Cleans up Posts table
UPDATE wp_posts SET post_content = REPLACE(post_content, '“', '“');
UPDATE wp_posts SET post_content = REPLACE(post_content, '”', '”');
UPDATE wp_posts SET post_content = REPLACE(post_content, '’', '’');
UPDATE wp_posts SET post_content = REPLACE(post_content, '‘', '‘');
UPDATE wp_posts SET post_content = REPLACE(post_content, '—', '–');
UPDATE wp_posts SET post_content = REPLACE(post_content, '–', '—');
UPDATE wp_posts SET post_content = REPLACE(post_content, '•', '-');
<?php
/**
* Blog Archive
*
* @package BE_Genesis_Child
* @since 1.0.0
* @link https://github.com/billerickson/BE-Genesis-Child
* @author Bill Erickson <bill@billerickson.net>
* @copyright Copyright (c) 2011, Bill Erickson
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
@gregrickaby
gregrickaby / functions.php
Created May 30, 2012 19:20
Custom Post-Info with Google Rich Snippet support (Genesis)
remove_action( 'genesis_before_post_content', 'genesis_post_info' );
add_action( 'genesis_before_post_content', 'child_post_info' );
/**
* Custom Post-Info with Google Rich Snippet support
*
* @author Greg Rickaby
* @since 1.0.0
*/
function child_post_info() {
if ( is_page() )
@LeaVerou
LeaVerou / dabblet.css
Created April 17, 2012 05:57
Vertical centering with Flexbox + margin fallback
/**
* Vertical centering with Flexbox + margin fallback
* Lea Verou & David Storey
*/
html, body { height: 100%; }
body {
width: 100%; /* needed for FF */
margin: 0;
@JPry
JPry / remove-wpe-info.php
Last active March 1, 2026 18:43
Remove WP Engine info from WP Dashboard
<?php
// Remove all evidence of WP Engine from the Dashboard, unless the logged in user is "wpengine"
$user = wp_get_current_user();
if ( $user->user_login != 'wpengine' ) {
add_action( 'admin_init', 'jpry_remove_menu_pages' );
add_action( 'admin_bar_menu', 'jpry_remove_admin_bar_links', 999 );
}
/**
@billerickson
billerickson / functions.php
Created April 11, 2012 17:36
oEmbed Transparency
<?php
/**
* oEmbed Transparency
*
* Used so that menus can appear on top of videos
*
* @author Bill Erickson
* @link http://www.billerickson.net/code/oembed-transparency
*
@luetkemj
luetkemj / wp-query-ref.php
Last active April 8, 2026 18:20
WP: Query $args
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.github.io
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php
*/
@GaryJones
GaryJones / functions.php
Last active August 25, 2018 11:50
Enqueue any style sheet with a conditional comment (usually for IE)
<?php
add_action( 'wp_enqueue_scripts', 'prefix_add_ie8_style_sheet', 200 );
/**
* Enqueue an IE-specific style sheet.
*
* Add a style sheet for everyone, then mark it as conditional to IE8 or below.
*
* @author Gary Jones
* @link https://garyjones.io/enqueued-style-sheet-extras#ie
@GaryJones
GaryJones / functions.php
Last active August 25, 2018 11:48
Enqueue preferred and alternative style sheets.
<?php
add_action( 'wp_enqueue_scripts', 'child_add_alternate_style_sheet' );
/**
* Enqueue preferred and alternate style sheet.
*
* WordPress already adds a persistent style sheet (style.css), so this
* function gives examples of adding a preferred and alternative style sheets.
*
* Persistent = browser MUST apply it.
@GaryJones
GaryJones / functions.php
Created March 1, 2012 14:56
Fix category query tweak + sticky posts + is_home issue.
<?php
add_filter( 'posts_results','child_query_is_home' );
/**
* Fixes an issue where a query that targets a taxonomy stops sticky posts from working
* on is_home.
*
* The code suggests that sticky posts should only be on the blog archive (is_home) page.
* However, if that query is amended with an inclusive cat, tag or tax restriction, then
* WP doesn't count the query as being the blog archive page anymore.