Skip to content

Instantly share code, notes, and snippets.

View richerimage's full-sized avatar

Richard Barratt richerimage

View GitHub Profile
@richerimage
richerimage / TinyMCE Styles
Created September 8, 2014 15:46
Add styles to TinyMCE in DNA Skin
class dna_custom_class extends thesisdna {
public function __construct() {
add_filter ('dna_tinymce', array($this, 'add_my_tinycss'));
}
public function add_my_tinycss($dna_admin_css) {
@richerimage
richerimage / Add svg to Wordpress
Last active August 29, 2015 14:06
Add SVG to WordPress Image Uploader
class dna_custom_class extends thesisdna {
public function __construct() {
add_action( 'admin_enqueue_scripts', array( $this, 'styles'));
add_filter( 'upload_mimes', array($this, 'cc_mime_types'));
}
add_shortcode('shortcode', array($this, 'my_shortcode'));
public function my_shortcode($atts, $content = null) {
extract(shortcode_atts(array(
"tag" => 'div',
"class" => '',
"id" => '',
), $atts));
@richerimage
richerimage / Add Image Sizes
Created October 20, 2014 15:04
Add Image Sizes
class dna_custom_class extends thesisdna {
public function __construct() {
add_image_size('Letterbox', 460, 258, true );
add_filter('image_size_names_choose', array($this, 'my_custom_sizes'));
}
@richerimage
richerimage / YouTube Minimal Branding
Created November 22, 2014 11:02
You Tube Minimal Branding
Append the following to the url: ?modestbranding=1;autohide=1&showinfo=0&controls=1&autoplay=0&rel=0
@richerimage
richerimage / Client Testimonial Taxonomy
Last active August 29, 2015 14:10
Client Testimonial Taxonomy
// Register Custom Taxonomy
function testimonials_taxonomy() {
$labels = array(
'name' => _x( 'Sectors', 'Taxonomy General Name', 'thesis_dna' ),
'singular_name' => _x( 'Sector', 'Taxonomy Singular Name', 'thesis_dna' ),
'menu_name' => __( 'Sector', 'thesis_dna' ),
'all_items' => __( 'All Sectors', 'thesis_dna' ),
'parent_item' => __( 'Parent Sector', 'thesis_dna' ),
'parent_item_colon' => __( 'Parent Sector:', 'thesis_dna' ),
@richerimage
richerimage / jQuery after page load
Created December 21, 2014 11:43
Use the following code instead to execute code only when everything on the page has loaded, including images.
$(window).bind("load", function() {
//YOUR CODE
});
@richerimage
richerimage / add span around first word
Created January 7, 2015 14:52
Add Span Around First Word
<script>
jQuery(function($){
$.fn.firstWord = function() {
var text = this.text().trim().split(' ');
var first = text.shift();
this.html((text.length > 0 ? '<span class="title-highlight">'+ first + '</span> ' : first) + text.join(' '));
};
$('h1').firstWord();
});
</script>
@richerimage
richerimage / add_fonts_to_Thesis 2.php
Last active August 29, 2015 14:17
Add fonts to Thesis 2
class dna_custom_class extends thesisdna {
public function __construct() {
add_filter('thesis_fonts', array($this, 'add_my_font'));
}
public function add_my_font($fonts) {