Skip to content

Instantly share code, notes, and snippets.

@billerickson
billerickson / gist:1325546
Last active September 5, 2024 01:27
Custom Avatar Field
<?php
/**
* Add Custom Avatar Field
* @author Bill Erickson
* @link http://www.billerickson.net/wordpress-custom-avatar/
*
* @param object $user
*/
function be_custom_avatar_field( $user ) { ?>
<h3>Custom Avatar</h3>
@billerickson
billerickson / gist:1325548
Last active October 14, 2016 08:11
Use Custom Avatar if Provided
<?php
/**
* Use Custom Avatar if Provided
* @author Bill Erickson
* @link http://www.billerickson.net/wordpress-custom-avatar/
*
*/
function be_gravatar_filter($avatar, $id_or_email, $size, $default, $alt) {
// If provided an email and it doesn't exist as WP user, return avatar since there can't be a custom avatar
@billerickson
billerickson / functions.php
Created March 22, 2012 20:57
Automatically Display Author Box
<?php
// Display Author box on Single and Archive
add_filter( 'get_the_author_genesis_author_box_single', '__return_true' );
add_filter( 'get_the_author_genesis_author_box_archive', '__return_true' );
@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, '•', '-');
@jaredatch
jaredatch / gist:3764381
Last active October 10, 2015 22:58
Customize image size used in the loop by Genesis
<?php
/**
* Customize image size used in the loop by Genesis
*
* @author Jared Atchison
* @link http://jaredatchison.com/code/
* @param string $image_size
* @global array $wp_query
* @global int $loop_counter
* @return string
@ramiabraham
ramiabraham / basic wp-login.php and wp-admin customization
Last active December 17, 2015 09:39
Some wp-login.php and wp-admin customization examples
<?php
/*
* Here are some basic WordPress admin customizations.
*/
// load a custom stylesheet for wp-login.php
function neato_prefix_custom_login_stylesheet() {
wp_enqueue_style( 'custom_login_stylesheet', get_template_directory_uri() . '/css/login.css' );
}
@jaredatch
jaredatch / gist:6085445
Last active December 20, 2015 06:19
Remove extra metaboxes when editing the "Home" page
<?php
/**
* Remove metaboxes we don't need when editing the "Home" page
*
* @since 1.0.0
*/
function ja_home_remove_metaboxes() {
// Replace 1206 with home post ID
if ( isset( $_GET['post'] ) && $_GET['post'] == '1206' ) {
remove_meta_box( 'genesis_inpost_seo_box', 'page', 'normal');
@nairnwebdesign
nairnwebdesign / genesis-post-titles.php
Created December 28, 2013 07:35
Changing Genesis H1 Post Titles to H2
/*
Changing Genesis H1 Post Titles to H2
*/
add_filter( 'genesis_post_title_output', 'ac_post_title_output', 15 );
function ac_post_title_output( $title )
{ if ( is_home() || is_archive() )
$title = sprintf( '<h1 class="entry-title"><a href="' . get_permalink() . '">%s</a></h1>', apply_filters( 'genesis_post_title_text',get_the_title() ) );
return $title;
@woogist
woogist / woocommerce-customer-order-csv-export-add-additional-columns.php
Created February 6, 2014 03:28
WooCommerce Customer/Order CSV Export: Add additional columns
<?php
// add custom column headers
function wc_csv_export_modify_column_headers( $column_headers ) {
$new_headers = array(
'column_1' => 'Column 1',
'column_2' => 'Column 2',
// add other column headers here in the format column_key => Column Name
);
@kloon
kloon / functions.php
Last active October 16, 2022 16:46
WooCommerce 2.1 variation price, revert to 2.0 format
/**
* Use WC 2.0 variable price format, now include sale price strikeout
*
* @param string $price
* @param object $product
* @return string
*/
function wc_wc20_variation_price_format( $price, $product ) {
// Main Price
$prices = array( $product->get_variation_price( 'min', true ), $product->get_variation_price( 'max', true ) );