Skip to content

Instantly share code, notes, and snippets.

View zoerooney's full-sized avatar

Zoe Rooney zoerooney

View GitHub Profile
@zoerooney
zoerooney / jquery.js
Last active August 15, 2023 02:21
Shopify minicart on non-Shopify site
<script>
jQuery.ajax({
type: 'GET',
url: 'http://mysite.myshopify.com/cart.json',
dataType: 'jsonp',
success: function(data) {
var item_count = data['item_count'];
var total_price = data['total_price']/100;
//If there are items in cart
@zoerooney
zoerooney / markup.html
Created August 8, 2014 18:41
Instafeed with links opening in new window
<div id="instafeed"></div>
<script>
var feed = new Instafeed({
clientId: 'XXXXXXXXXXXXXXXXXX',
accessToken: 'abcdefghijklmnop',
get: 'user',
userId: 12345678,
limit: 5,
after: function() {
external();
@zoerooney
zoerooney / page-gallery.php
Last active April 6, 2021 14:29
Gallery page using ACF PRO with a dynamically generated zip file download of all gallery images. More info/ tutorial here: http://zoerooney.com/blog/tutorials/wordpress-gallery-with-automated-zip-file-download/
@zoerooney
zoerooney / page-shopify.php
Last active April 3, 2020 12:44
Shopify Collection Embedded in WordPress
<?php
/**
* Template Name: Shopify Collection Demo
*
*/
get_header(); ?>
<div id="primary" class="full-width">
@zoerooney
zoerooney / no-li-nav-menu-v1.php
Last active February 3, 2020 08:49
Create an arguably cleaner nav menu in WordPress. Version 1 replacing the LI elements in a WordPress menu with SPAN elements, while maintaining classes, etc., while version 2 results in just A elements, still maintaining all the classes, etc. Post: http://zoerooney.com/blog/tutorials/removing-list-items-wordpress-menus/
<?php
// first let's get our nav menu using the regular wp_nav_menu() function with special parameters
$cleanmenu = wp_nav_menu( array(
'theme_location' => 'social', // we've registered a theme location in functions.php
'container' => false, // this is usually a div outside the menu ul, we don't need it
'items_wrap' => '<nav id="%1$s" class="%2$s">%3$s</nav>', // replacing the ul with nav
'echo' => false, // don't display it just yet
) );
@zoerooney
zoerooney / header-for-most-emails.html
Last active August 1, 2018 13:49
Shopify notification emails, bettered. I usually use the first one as the header for all the emails other than the ones with specific template code below. Be sure to put the correct logo dimensions in place in each snippet before using it!
<div style="width: 100%; margin: 0 auto; text-align: center; background: #ffffff;">
<a href="{{ shop.url }}"><img src="{{ 'logo.png' | asset_url }}" alt="{{ shop_name }}" width="WIDTH" height="HEIGHT" style="margin: 0 auto;" /></a>
<br/><br/>
</div>
@zoerooney
zoerooney / wordpress-twitter-cards.php
Last active January 26, 2017 10:35
WordPress Twitter card info (assumes you've already got basic open graph data via a plugin), tutorial here: http://zoerooney.com/blog/tutorials/increase-share-ability-using-twitter-cards/
<?php // Include Twitter IDs for content creator (you, usually) ?>
<meta name="twitter:site" content="@zoe_rooney"/>
<meta name="twitter:creator" content="@zoe_rooney"/>
<?php
// get current post ID
$currentpost = get_the_ID();
// get radio value
$radio = get_field( 'twitter_card_options', $currentpost );
data-platform="<?php echo implode(', ', get_field('platform')); ?>"
data-project-type="<?php echo implode(', ', get_field('project_type')); ?>"
data-designer="<?php the_field('designers'); ?>"
@zoerooney
zoerooney / breadcrumbs.liquid
Last active September 7, 2016 03:38
Shopify product breadcrumbs showing tag-based subcategories. Full tutorial here: http://zoerooney.com/blog/tutorials/shopify-product-breadcrumbs-with-tag-support/
<div class="breadcrumbs">
<a href="/" class="homepage-link">Home</a>
{% if collection.handle %}
&gt;
{% capture url %}/collections/{{ collection.handle }}{% endcapture %}
<a href="{{ collection.url }}" class="collection-link">{{ collection.title }}</a>
{% endif %}
<span class="bc-tags"></span><!-- this is a placeholder for the tag if there is one -->
</div> <!-- end .breadcrumbs -->