Skip to content

Instantly share code, notes, and snippets.

View BFTrick's full-sized avatar

Patrick Rauland BFTrick

View GitHub Profile
@BFTrick
BFTrick / functions.php
Created October 17, 2012 16:50
Do Shortcodes in WordPress Nav Menu
// do shortcodes in the wp nav menu
add_filter('wp_nav_menu', 'do_shortcode', 11);
@BFTrick
BFTrick / functions.php
Created October 30, 2012 19:46
Remove Image & Height Dimensions Using WordPress Filters
//http://speakinginbytes.com/2012/11/responsive-images-in-wordpress/
add_filter( 'post_thumbnail_html', 'remove_thumbnail_dimensions', 10 );
add_filter( 'the_content', 'remove_thumbnail_dimensions', 10 );
function remove_thumbnail_dimensions( $html ) {
$html = preg_replace( '/(width|height)=\"\d*\"\s/', "", $html );
return $html;
}
@BFTrick
BFTrick / functions.php
Created November 15, 2012 01:40
Remove Blog Tagline & Rename Section in WordPress Theme Customizer
// remove control
$wp_customize->remove_control('blogdescription');
// rename existing section
$wp_customize->add_section( 'title_tagline' , array(
'title' => __('Site Title','mytheme'),
'priority' => 20,
));
@BFTrick
BFTrick / functions.php
Created November 15, 2012 01:42
Remove Section in WordPress Theme Customizer
// remove section
$wp_customize->remove_section( 'section_id');
@BFTrick
BFTrick / functions.php
Created November 15, 2012 01:44
Remove Blog Tagline in WordPress Theme Customizer
// remove control
$wp_customize->remove_control('control_id');
@BFTrick
BFTrick / functions.php
Created November 15, 2012 01:49
Rename Existing Section in WordPress Theme Customizer
// rename existing sections
$wp_customize->add_section( 'section_id' , array(
'title' => __('Section Title','mytheme'),
'priority' => 20,
));
@BFTrick
BFTrick / terminal
Created January 26, 2013 17:59
Turn off MySQL through the terminal
killall -9 mysqld
@BFTrick
BFTrick / terminal
Created January 26, 2013 18:01
Turn of Apache through the terminal
sudo apachectl stop
@BFTrick
BFTrick / sql-command.sql
Last active April 25, 2022 14:31
A SQL command to delete all orphaned post meta data
DELETE pm
FROM wp_postmeta pm
LEFT JOIN wp_posts wp ON wp.ID = pm.post_id
WHERE wp.ID IS NULL
@BFTrick
BFTrick / my-woocommerce-modifications.php
Last active August 7, 2017 09:03
A WordPress plugin that modifies the WooCommerce category page. It remove the title, price, and add to cart button. Reference this WordPress Answers question (http://wordpress.stackexchange.com/questions/61398/hide-price-title-in-store-thumbnail-dispay) to see why I made it.
<?php
/*
Plugin Name: My WooCommerce Modifications
Plugin URI: http://woothemes.com/
Description: Modificatinos to my WooCommerce site
Version: 1.0
Author: Patrick Rauland
Author URI: http://www.patrickrauland.com/
License: GPL version 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*/