Skip to content

Instantly share code, notes, and snippets.

Avatar

Phil Wylie mustardBees

View GitHub Profile
@mustardBees
mustardBees / gist:4030980
Created Nov 7, 2012
Prevent WordPress Admin Toolbar from being hidden via the user profile edit screen
View gist:4030980
/**
* Prevent Toolbar from being hidden
*
* Hide the "Show Toolbar when viewing site" option on the profile page editor.
*
* @author: Don Fischer
* @link http://goo.gl/P5FTK
*/
function iweb_hide_admin_bar_profile_option() {
echo '<style type="text/css">.show-admin-bar { display: none !important; }</style>';
@mustardBees
mustardBees / gist:4125347
Created Nov 21, 2012
Shortcode to retrieve a theme option within a post
View gist:4125347
/**
* Get option shortcode
*
* Make it easy to add theme options within posts. Example usage:
* [get-theme-option key="contact_telephone"]
*
* @param array $theme_option Shortcode key/values
* @return string The value returned by get_option()
*/
function iweb_get_option_shortcode( $theme_option ) {
@mustardBees
mustardBees / gist:4125424
Created Nov 21, 2012
Change WordPress email sender
View gist:4125424
/**
* Change wp_mail's from name
*/
function iweb_change_from_name( $name = '' ) {
return get_bloginfo( 'name' );
}
add_filter( 'wp_mail_from_name', 'iweb_change_from_name' );
/**
* Change wp_mail's from email
@mustardBees
mustardBees / gist:4125893
Created Nov 21, 2012
HTML script tag to load FitVids.js into WordPress
View gist:4125893
<script src="<?php echo get_stylesheet_directory_uri(); ?>/js/plugins/jquery.fitvids.js"></script>
@mustardBees
mustardBees / gist:4125913
Created Nov 21, 2012
Responsive video embedding with FitVids.JS and WordPress
View gist:4125913
jQuery(document).ready(function($) {
$('.post').fitVids();
});
@mustardBees
mustardBees / gist:4125935
Created Nov 21, 2012
Prevent large images from breaking your WordPress theme
View gist:4125935
if ( ! isset( $content_width ) ) {
$content_width = 560;
}
@mustardBees
mustardBees / gist:4125940
Created Nov 21, 2012
Prevent large images from breaking your WordPress theme
View gist:4125940
if ( function_exists( 'add_theme_support' ) ) {
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( $content_width, 1024, false );
}
@mustardBees
mustardBees / gist:4125978
Created Nov 21, 2012
WordPress: Prevent images from being inserted with a link
View gist:4125978
/**
* Prevent images from being inserted with a link.
* User must specify if they really want to link to the attachment page
*/
update_option( 'image_default_link_type', 'none' );
@mustardBees
mustardBees / gist:4125995
Created Nov 21, 2012
WordPress 3.3 with bundled jQuery UI
View gist:4125995
wp_enqueue_script( 'jquery-ui-datepicker' );
wp_enqueue_style( 'jquery.ui.theme', get_stylesheet_directory_uri() . '/css/ui-lightness/jquery-ui-1.8.16.custom.css' );
@mustardBees
mustardBees / gist:4131320
Created Nov 22, 2012
Override post thumbnail attributes in your WordPress theme
View gist:4131320
$post_thumbnail_attributes = array(
'class' => 'our-image-class maybe-add-another-class',
'alt' => get_the_title(),
'title' => get_the_title()
);
the_post_thumbnail( 'post-thumbnail', $post_thumbnail_attributes );
You can’t perform that action at this time.