Skip to content

Instantly share code, notes, and snippets.

Fitz Haile fitzhaile

Block or report user

Report or block fitzhaile

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@fitzhaile
fitzhaile / tiny-mce.php
Created Nov 15, 2013
Config for Tiny MCE in Wordpress.
View tiny-mce.php
<?php
/**
* Add custom styles to the styleselect dropdown
*
* @since required+ Foundation 0.5.0
*
* @param array $settings
* @return array
*/
@fitzhaile
fitzhaile / enable_tags.php
Last active Dec 20, 2015
WP: Enable Page tags
View enable_tags.php
<?php
// Include the following in functions.php
//-------------------------------------------
// add tag support to pages
function tags_support_all() {
register_taxonomy_for_object_type('post_tag', 'page');
}
// ensure all tags are included in queries
@fitzhaile
fitzhaile / script.rb
Created Jun 5, 2013
Base 64 encode Sass script
View script.rb
# Additional SASS Script functions
require 'sass'
require 'base64'
module Sass::Script::Functions
def base64encode(string)
assert_type string, :String
file = "."+string.value
data = File.open(file, "rb") {|io| io.read}
data = [data].flatten.pack("m").gsub("\n","")
@fitzhaile
fitzhaile / svg-png-fallback.js
Created Mar 26, 2013
Modernizr PNG SVG Fallback
View svg-png-fallback.js
if(!Modernizr.svg){
$("img.svg").each(function(){
var src = this.src.replace('.svg', '.png');
this.src = src;
});
}
View multiple-3rd-party-widgets.js
(function() {
var script,
scripts = document.getElementsByTagName('script')[0];
function load(url) {
script = document.createElement('script');
script.async = true;
script.src = url;
scripts.parentNode.insertBefore(script, scripts);
@fitzhaile
fitzhaile / file_exists.rb
Last active Dec 14, 2015
Ruby: Custom file_exists Sass Function
View file_exists.rb
module Sass::Script::Functions
def file_exists(image_file)
path = Dir.getwd + "/" + image_file.value
Sass::Script::Bool.new(File.exists?(path))
end
end
@fitzhaile
fitzhaile / *.php
Last active Dec 12, 2015
WP: Typical Testimonials Markup
View *.php
<?php $testimonials = new WP_Query('post_type=testimonial'.ks_query('testimonials')); ?>
<div class="testimonials">
<?php while( $testimonials->have_posts() ): $testimonials->the_post(); ?>
<blockquote class="testimonial">
<?php the_content(); ?>
<footer>
<p>
<?php the_title(); ?>
</p>
View gist:4772341
<?php $attachments = new Attachments( 'attachments' ); ?>
<?php if( $attachments->exist() ) : ?>
<h3>Attachments</h3>
<ul>
<?php while( $attachments->get() ) : ?>
<li>
ID: <?php echo $attachments->id(); ?><br />
Type: <?php echo $attachments->type(); ?><br />
Subtype: <?php echo $attachments->subtype(); ?><br />
URL: <?php echo $attachments->url(); ?><br />
View gist:4772339
<?php
function my_attachments( $attachments )
{
$args = array(
// title of the meta box (string)
'label' => 'My Attachments',
// all post types to utilize (string|array)
@fitzhaile
fitzhaile / is_blog.php
Created Oct 16, 2012 — forked from wesbos/is_blog.php
WordPress is_blog()
View is_blog.php
function is_blog () {
global $post;
$posttype = get_post_type($post );
return ( ((is_archive()) || (is_author()) || (is_category()) || (is_home()) || (is_single()) || (is_tag())) && ( $posttype == 'post') ) ? true : false ;
}
Usage:
<?php if (is_blog()) { echo 'You are on a blog page'; } ?>
You can’t perform that action at this time.