Skip to content

Instantly share code, notes, and snippets.

@dannyockilson
dannyockilson / gist:8438642
Created January 15, 2014 15:50
Drop-in for custom wp-mail settings
/* Set Default Mail From Name */
function custom_wp_mail_from_name( $original_email_from ){
return 'Danny Wilson';
}
add_filter( 'wp_mail_from_name', 'custom_wp_mail_from_name' );
/* Set Default Mail From email */
function custom_wp_mail_from( $original_email_address ){
return 'danny@iamdannywilson.com';
}

Animated Navigation Style

Alternative Navigation Style using CSS3 animations and transitions.

A Pen by Danny on CodePen.

License.

@dannyockilson
dannyockilson / gist:6509594
Created September 10, 2013 13:44
Simple Wordpress Secured Content Shortcode: Add this to your functions.php to enable [is_logged_in]Members only content[/is_logged_in] and [not_logged_in]Non Members content[/not_logged_in] in posts/pages
function is_logged_in($atts, $content){
if(is_user_logged_in()){
return do_shortcode($content);
}
else {
// this is used incase you want to attach an icon/message to show more information is available on login
return "<span class='secured'></span>";
}
}
@dannyockilson
dannyockilson / of_section_hider
Last active December 17, 2015 11:59
Hide sections of options when using Wordpress Options Framework http://wptheming.com/options-framework-theme/
// In options.php
$options[] = array(
'name' => __('Example Hide', 'options_framework_theme'),
'desc' => __('Example Hide Multiple Fields', 'options_framework_theme'),
'id' => 'example_showhidden',
'type' => 'checkbox');
$options[] = array(
'name' => __('Example Hidden 1', 'options_framework_theme'),
@dannyockilson
dannyockilson / lipsum shortcode
Created May 17, 2013 14:33
Wordpress Function to add [lipsum] | [lipsum amount="int"] | [lipsum type="{ paras | words | bytes | lists }"]
function lipsum_shortcode($atts) {
extract(shortcode_atts(array('amount' => 1, 'type' => 'paras'), $atts));
$lipsum = simplexml_load_file("http://www.lipsum.com/feed/xml?amount=$amount&what=$type")->lipsum;
return $lipsum;
}
add_shortcode('lipsum', 'lipsum_shortcode');