Skip to content

Instantly share code, notes, and snippets.

View cdharrison's full-sized avatar
🎯
Focusing

@cdharrison cdharrison

🎯
Focusing
View GitHub Profile
@cdharrison
cdharrison / fooevents.php
Created May 14, 2018 21:50
This adds the ability for FooEvents data to be automatically detected and mapped properly when importing a CSV of Events-as-Products for WooCommerce.
<?php
/**
* Register FooEvents columns in the importer.
* @link: https://github.com/woocommerce/woocommerce/wiki/Product-CSV-Importer-&-Exporter#adding-custom-import-columns-developers
*
* @param array $options
* @return array $options
*/
function add_column_to_importer( $options ) {
@cdharrison
cdharrison / _post-status.scss
Last active August 3, 2019 01:53
WordPress Post Status
.status-draft{
background: #FFFED8;
&:before{
content: 'DRAFT';
background: #7F7E46;
color: #fff;
display: block;
padding: 5px;
text-transform: uppercase;
}
@cdharrison
cdharrison / css-scan.js
Created August 3, 2013 04:15
How to get list of all of the CSS classes used in an HTML file. Source: http://stackoverflow.com/a/7540783
var used = [];
var elements = null;
//get all elements
if (typeof document.getElementsByTagName != 'undefined') {
elements = document.getElementsByTagName('*');
}
if (!elements || !elements.length) {
elements = document.all; // ie5
@cdharrison
cdharrison / css-preprocessor-libraries.md
Created October 17, 2013 11:40
CSS Preprocessor Frameworks + Mixin Libraries

Frameworks/Mixin Libraries

@cdharrison
cdharrison / bootstrap joomla menus
Created February 21, 2013 20:25
Enable Bootstrap dropdown menus in Joomla
Add before </body>:
<script type="text/javascript">
(function($){
$(document).ready(function(){
$('.dropdown-toggle').dropdown();
// dropdown
$('.parent').addClass('dropdown');
$('.parent > a').addClass('dropdown-toggle');
$('.parent > a').attr('data-toggle', 'dropdown');
@cdharrison
cdharrison / pinterest
Created May 15, 2012 14:27
Set Default Pinterest Share Image based on Featured Image
<?php if ( has_post_thumbnail() ) :
$src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), array( 720,405 ), false, '' );
?>
<a href="http://pinterest.com/pin/create/button/?media=<?php echo $src[0]; ?>&url=<?php the_permalink() ?>" class="pin-it-button" count-layout="none"><img border="0" src="//assets.pinterest.com/images/PinExt.png" title="Pin It" /></a>
<?php else : ?>
<a href="http://pinterest.com/pin/create/button/?media=http://example.com/example.png&url=<?php the_permalink() ?>" class="pin-it-button" count-layout="none"><img border="0" src="//assets.pinterest.com/images/PinExt.png" title="Pin It" /></a>
<?php endif; ?>
@cdharrison
cdharrison / tiled-gallery-snippet.md
Last active February 19, 2016 15:16
I'm using [CMB2](https://github.com/WebDevStudios/CMB2) to enable me to add custom images to a post via a [File field type](https://github.com/WebDevStudios/CMB2/wiki/Field-Types#file). Rather than have a user create a gallery and place it within the body of content, I wanted to control where and how it displayed.
@cdharrison
cdharrison / SassMeister-input.scss
Created January 9, 2014 16:54
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.2)
// Compass (v1.0.0.alpha.17)
// ----
$grey: #777;
$logosize: 31;
$blockpercent: 7%;
// Calculate the proper size of the blocks
Go to Alfred Preferences
Web Search
Add Custom Search
Search URL: http://smile.amazon.com/s/ref=nb_sb_noss_2?url=search-alias%3Daps&field-keywords={query}
Title: Smile
Keyword: smile
URL for sharing: alfred://customsearch/Smile/smile/utf8/noplus/http://smile.amazon.com/s/ref=nb_sb_noss_2?url=search-alias%3Daps&field-keywords={query} (Copy and paste into your browser and it should open Alfred to add this.)
@cdharrison
cdharrison / archives.php
Created November 21, 2013 20:01
A slightly fancier archives page for WordPress
<?php
/**
* @package WordPress
* @subpackage Tersus
Template Name: Archives
*/
?>