Skip to content

Instantly share code, notes, and snippets.

View zoerooney's full-sized avatar

Zoe Rooney zoerooney

View GitHub Profile
@zoerooney
zoerooney / tweet-quicktag.php
Last active July 9, 2016 12:01
Code to add inline click-to-tweet links in WordPress while using the text editor. Full tutorial here: http://zoerooney.com/blog/tutorials/inline-click-to-tweet-functionality/
function add_tweet_quicktag(){ ?>
<script>
// create a new quicktag button labeled "tweet"
QTags.addButton( 'quicktweet', 'tweet', selection_callback );
// on click, it triggers this callback:
function selection_callback(e, c, ed) {
// we want to grab the selected text and we're going to get a URL as well
var selection, postURL, t = this;
@zoerooney
zoerooney / sass-sticky-footer.scss
Created December 31, 2013 03:55
SASS Sticky Footer Mixin - I didn't find one using my favorite method (this one: http://cleanstickyfooter.herokuapp.com/) so I wrote it up myself.
@zoerooney
zoerooney / initialize.js
Created December 19, 2013 15:51
Galleriffic + Pin It Button on Hover
jQuery(document).ready(function($){
$('#thumbs').galleriffic({
imageContainerSel: '#slideshow',
controlsContainerSel: '#controls',
loadingContainerSel: '#loading',
numThumbs: 9999,
renderSSControls: false,
onSlideChange: function(prevIndex, nextIndex) {
// get the pin it URL from the next slide
var piniturl = this.find('ul.thumbs li.selected .sm-pinit a').attr('href');
@zoerooney
zoerooney / pluginlist.php
Created December 10, 2013 06:07
Print plugin list in WordPress admin page. Part of this project: http://zoerooney.com/blog/tag/wordpress-reporting-plugin/
<div class="module">
<h3>Currently Installed Plugins</h3>
<?php
// assign get_plugins() to a variable
$current_plugins = get_plugins();
// something should happen if no plugins are installed
if ( empty( $current_plugins ) ) :
echo '<p>Unable to display plugins. This could mean there are no plugins installed, or that the plugins directory is inaccessible.</p>';
@zoerooney
zoerooney / tabs.js
Created December 2, 2013 04:23
Clean tabbed product descriptions in Shopify with jQuery. Just requires that the tabs be entered into the description field with Heading 5 styling applied to each tab, followed by regularly formatted tab content. Tutorial: http://zoerooney.com/blog/tutorials/clean-tabbed-product-descriptions-for-shopify/
jQuery(document).ready(function($){
// This first section is all about formatting the content correctly for tabs
// Add the opening list tag before the first H5 within the description
$('.description h5:first-of-type').before('<ul class="tabs" />');
// Loop through each H5 in the description
$('.description h5').each(function(index, value){
// Assign them each a number, in order
@zoerooney
zoerooney / feed-example.html
Last active December 22, 2015 10:15
Pinterest via RSS feed and Google Feed API, as discussed here: http://zoerooney.com/blog/tutorials/display-a-pinterest-feed-almost-anywhere-via-rss/
<div id="pinfeed"></div>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<!-- ref: https://developers.google.com/feed/v1/devguide -->
<script type="text/javascript">
google.load('feeds', '1');
function initialize() {
@zoerooney
zoerooney / example.html
Last active December 20, 2015 04:38
quick WP template tag example
<h2>Post Title</h2>
becomes
<h2><?php the_title(); ?></h2>
@zoerooney
zoerooney / inline-validation.js
Last active December 17, 2015 21:09
Customized MailChimp code that works inline with WordPress. The JS goes in the footer - make sure to replace the URL on line 9 with the one from YOUR account (you can get it by grabbing the original version of this code - generate a "classic" embedded sign-up form and it'll be in there). There's also a bit you'll need to replace in the form code…
<script type="text/javascript">
var fnames = new Array();var ftypes = new Array();fnames[0]='EMAIL';ftypes[0]='email';fnames[1]='FNAME';ftypes[1]='text';fnames[2]='LNAME';ftypes[2]='text';
jQuery(document).ready( function($) {
var options = { errorClass: 'mce_inline_error', errorElement: 'div', onkeyup: function(){}, onfocusout:function(){}, onblur:function(){} };
var mce_validator = $("#mc-embedded-subscribe-form").validate(options);
$("#mc-embedded-subscribe-form").unbind('submit');//remove the validator so we can get into beforeSubmit on the ajaxform, which then calls the validator
options = { url: 'http://replace-with-your-specific-url', type: 'GET', dataType: 'json', contentType: "application/json; charset=utf-8",
beforeSubmit: function(){
@zoerooney
zoerooney / in-page-dropdown.css
Last active December 17, 2015 15:29
Code snippets for a tutorial on drop down sidebar widgets & content blocks in WordPress. See also: https://gist.github.com/zoerooney/5632182 Tutorial link: http://zoerooney.com/blog/tutorials/faqs-lists-and-jquery-how-to-create-drop-down-content-blocks/
.question:hover {
cursor: pointer;
opacity: 0.6;
}
/* Not much to see here - most of the action-oriented code has been moved to the jQuery */
@zoerooney
zoerooney / sidebar-dropdown-function.php
Last active December 17, 2015 15:29
Code snippets for a tutorial on drop down sidebar widgets & content blocks in WordPress. See also: https://gist.github.com/zoerooney/5632470 Tutorial link to come.
<?php
register_sidebar( array(
'name' => 'sidebar',
'id' => 'sidebar-1',
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
) );
?>