Skip to content

Instantly share code, notes, and snippets.

View joshuafredrickson's full-sized avatar
🍊
Orange pineapple

Joshua Fredrickson joshuafredrickson

🍊
Orange pineapple
View GitHub Profile
@joshuafredrickson
joshuafredrickson / .htaccess
Last active August 29, 2015 13:56
.htaccess: Force download by filetype
# Force download by filetype
<FilesMatch "\.(mp3|pdf)$">
ForceType application/octet-stream
Header set Content-Disposition attachment
</FilesMatch>
@joshuafredrickson
joshuafredrickson / gist:9117537
Last active August 29, 2015 13:56
WordPress: Improve jpg quality
// Improve jpg quality
add_filter('jpeg_quality', 'op_jpeg_quality');
function op_jpeg_quality($arg) {
return (int)80; // value between 60-100
}
@joshuafredrickson
joshuafredrickson / functions.php
Created April 6, 2014 16:26
WordPress - Genesis: Modify breadcrumbs
// Modify breadcrumb arguments
add_filter( 'genesis_breadcrumb_args', 'sp_breadcrumb_args' );
function sp_breadcrumb_args( $args ) {
// $args['home'] = 'Home';
$args['sep'] = ' <span>&rsaquo;</span> ';
// $args['list_sep'] = ', '; // Genesis 1.5 and later
// $args['prefix'] = '<div class="breadcrumb">';
// $args['suffix'] = '</div>';
// $args['heirarchial_attachments'] = true; // Genesis 1.5 and later
// $args['heirarchial_categories'] = true; // Genesis 1.5 and later
@joshuafredrickson
joshuafredrickson / functions.php
Last active August 29, 2015 14:25 — forked from bitfade/gist:4555047
Remove empty p tags for custom shortcodes
// Remove empty p tags for custom shortcodes
add_filter('the_content', 'op_content_filter');
function op_content_filter($content) {
// array of custom shortcodes requiring the fix
$block = join('|',array('shortcode1'));
// opening tag
$rep = preg_replace("/(<p>)?\[($block)(\s[^\]]+)?\](<\/p>|<br \/>)?/","[$2$3]",$content);
// closing tag
@joshuafredrickson
joshuafredrickson / functions.php
Created October 12, 2015 14:16
WordPress: Disable XML-RPC
// Disable XML-RPC
add_filter( 'xmlrpc_enabled', '__return_false' );
@joshuafredrickson
joshuafredrickson / gist:4757981
Last active December 12, 2015 10:19
WordPress: Disable Theme Editor - wp-config.php
/** Disable Theme Editor */
define('DISALLOW_FILE_EDIT', true);
@joshuafredrickson
joshuafredrickson / gist:4758120
Last active December 12, 2015 10:19 — forked from plavet/gist:2806211
jQuery: function, noConflict
// jQuery.noConflict();
(function($) {
})(jQuery);
@joshuafredrickson
joshuafredrickson / gist:4772190
Last active December 12, 2015 12:29
WordPress: Create wp_editor for code; disable WYSIWYG functions
$content = 'CONTENT';
$editor_id = 'EDITOR_ID';
$settings = array( 'tinymce' => false, 'media_buttons' => false, 'quicktags' => false, 'wpautop' => false );
wp_editor($content, $editor_id, $settings);
@joshuafredrickson
joshuafredrickson / gist:5286107
Last active December 15, 2015 15:59
WordPress - Genesis: Change "Speak your mind" comment title
/** Modify the speak your mind text */
add_filter( 'genesis_comment_form_args', 'op_comment_form_args' );
function op_comment_form_args($args) {
$args['title_reply'] = 'Leave a Comment';
return $args;
}
@joshuafredrickson
joshuafredrickson / gist:5286127
Created April 1, 2013 16:50
WordPress - Genesis: Change footer copyright text
/** Change footer copyright text */
add_filter('genesis_footer_creds_text', 'op_footer_creds_text');
function op_footer_creds_text( $creds ) {
$creds = 'Copyright &copy; '.date('Y').' <a href="'.home_url().'">'.get_bloginfo('description').'</a> &middot; All Rights Reserved.';
return $creds;
}