Skip to content

Instantly share code, notes, and snippets.

@brycejacobson
brycejacobson / woocommerce-optimize-scripts.php
Created October 13, 2022 13:29 — forked from DevinWalker/woocommerce-optimize-scripts.php
Only load WooCommerce scripts on shop pages and checkout + cart
/**
* Optimize WooCommerce Scripts
* Remove WooCommerce Generator tag, styles, and scripts from non WooCommerce pages.
*/
add_action( 'wp_enqueue_scripts', 'child_manage_woocommerce_styles', 99 );
function child_manage_woocommerce_styles() {
//remove generator meta tag
remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) );
@brycejacobson
brycejacobson / wp-fix-curly-quotes.sql
Created December 19, 2017 22:50 — forked from chuckreynolds/wp-fix-curly-quotes.sql
SQL Statement Replace Smart Curly Quotes with Regular Quotes in WordPress. I was migrating an old wp site with a ton of content I noticed a lot of curly quotes / smart quotes and the curly single quotes. My OCD hates that and it's not proper and looks bad to bots so I wanted to batch change them all to regular ascii quotes. This statement handle…
UPDATE wp_posts SET post_content = replace(replace(replace(post_content, '“', '"'), '”', '"'), '’', '''');
@brycejacobson
brycejacobson / functions.php
Created February 18, 2014 15:35 — forked from thomasgriffin/gist:9071378
Remove width and height attributes from images in Soliloquy sliders.
<?php
add_action( 'tgmsp_callback_start', 'tgm_soliloquy_remove_image_attr' );
function tgm_soliloquy_remove_image_attr( $id ) {
$script = 'var slides = $(slider).find(".soliloquy-slides > li img");';
$script .= '$(slides).each(function(i){';
$script .= '$(this).removeAttr("width height");';
$script .= '});';
echo $script;
@brycejacobson
brycejacobson / search-form-input-box.php
Created August 20, 2013 21:17 — forked from studiopress/search-form-input-box.php
Genesis search form functions.
<?php
//* Do NOT include the opening php tag
//* Customize search form input box text
add_filter( 'genesis_search_text', 'sp_search_text' );
function sp_search_text( $text ) {
return esc_attr( 'Search my blog...' );
}
@brycejacobson
brycejacobson / css-retina-logo.css
Created July 23, 2013 13:12 — forked from jonbellah/Single media query
CSS for retina logo using background image.
.logo {
background: url(images/example.jpg);
}
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
.logo {
background: url(images/example@2x.jpg);
background-size: 100px 100px;
}
@brycejacobson
brycejacobson / genesis-custom-enqueue-script.php
Created July 23, 2013 13:08 — forked from jonbellah/gist:4583404
Load custom scripts on specific pages in WordPress using Genesis.
<?php
//* Do NOT include the opening php tag
/** Load scripts on Portfolio page */
add_action('genesis_after_footer', 'child_load_portfolio');
function child_load_portfolio() {
if(is_page('Portfolio')) {
wp_register_script( 'isotope', get_bloginfo('stylesheet_directory').'/lib/js/jquery.isotope.min.js' );
wp_enqueue_script ( 'isotope' );
}
@brycejacobson
brycejacobson / customize.php
Created July 18, 2013 16:19 — forked from studiopress/customize.php
WordPress Genesis Customization's
<?php
//* Do NOT include the opening php tag
//* Customize the entry meta in the entry header (requires HTML5 theme support)
add_filter( 'genesis_post_info', 'post_info_filter' );
function post_info_filter($post_info) {
$post_info = '[post_date] by [post_author_posts_link] [post_comments] [post_edit]';
return $post_info;
}
<?php
function login_with_email_address($username) {
$user = get_user_by_email($username);
if(!empty($user->user_login))
$username = $user->user_login;
return $username;
}
add_action('wp_authenticate','login_with_email_address');