Skip to content

Instantly share code, notes, and snippets.

@amdrew
amdrew / gist:5747046
Last active December 18, 2015 07:29
Allows you to add more fonts to Shop Front's typography plugin
function shopfront_child_theme_site_title_fonts( $fonts ) {
// the font-name must match the google font name exactly as shown on https://edgewebfonts.adobe.com/fonts
$fonts['pt-sans'] = 'PT Sans';
$fonts['droid-sans'] = 'Droid Sans';
return $fonts;
}
add_filter( 'shopfront_typography_site_title_fonts', 'shopfront_child_theme_site_title_fonts' );
@amdrew
amdrew / gist:5747053
Last active December 18, 2015 07:29
Allows you to add more fonts to Shop Front's typography plugin
<?php
function shopfront_child_theme_body_fonts( $fonts ) {
// the font-name must match the google font name exactly as shown on https://edgewebfonts.adobe.com/fonts
$fonts['pt-sans'] = 'PT Sans';
$fonts['droid-sans'] = 'Droid Sans';
return $fonts;
}
<?php
function shopfront_child_theme_breadcrumbs() {
if ( function_exists( 'yoast_breadcrumb' ) && !is_home() )
yoast_breadcrumb( '<p id="breadcrumbs">', '</p>' );
}
add_action( 'shopfront_content_start', 'shopfront_child_theme_breadcrumbs' );
@amdrew
amdrew / gist:5914688
Last active December 19, 2015 06:49
Disable the default post type archive page in Easy Digital Downloads
<?php
if ( ! defined( 'EDD_DISABLE_ARCHIVE' ) )
define( 'EDD_DISABLE_ARCHIVE', true );
@amdrew
amdrew / gist:5942614
Last active December 19, 2015 10:48
Add colorbox to the lightbox array in Easy Image Gallery
<?php
function my_theme_easy_image_gallery_lightbox( $lightboxes ) {
// the option that is saved to the database, and the label that appears in the select menu
$lightboxes['colorbox'] = 'Colorbox';
return $lightboxes;
}
add_filter( 'easy_image_gallery_lightbox', 'my_theme_easy_image_gallery_lightbox' );
@amdrew
amdrew / gist:5942619
Last active December 19, 2015 10:48
Load the required scripts for Colorbox into the Easy Image Gallery plugin http://wordpress.org/plugins/easy-image-gallery/
<?php
function my_theme_easy_image_gallery_scripts() {
$lightbox = function_exists( 'easy_image_gallery_get_lightbox' ) ? easy_image_gallery_get_lightbox() : '';
if ( 'colorbox' == $lightbox ) {
wp_enqueue_script( 'colorbox-js', get_stylesheet_directory_uri() . '/colorbox/jquery.colorbox-min.js', array( 'jquery' ), '1.4.26', true );
wp_enqueue_style( 'colorbox-css', get_stylesheet_directory_uri() . '/colorbox/colorbox.css', '', '1.4.26', 'screen' );
}
@amdrew
amdrew / gist:5942621
Last active December 19, 2015 10:48
Load the required JS call in footer for Easy Image Gallery http://wordpress.org/plugins/easy-image-gallery/
<?php
function my_theme_easy_image_gallery_js() {
$lightbox = function_exists( 'easy_image_gallery_get_lightbox' ) ? easy_image_gallery_get_lightbox() : '';
if ( 'colorbox' == $lightbox ) { ?>
<script>
jQuery(document).ready(function() {
@amdrew
amdrew / gist:5988696
Last active December 19, 2015 17:08
Add Easy Image Gallery just before the content (and after the featured image) on Shop Front single download pages. Paste into functions.php
<?php
function my_theme_easy_image_gallery() {
// return if we're not on a single download page
if ( ! is_singular( 'download' ) )
return;
// stop it appending to the end of the gallery automatically
remove_filter( 'the_content', 'easy_image_gallery_append_to_content' );
@amdrew
amdrew / gist:6246027
Last active December 21, 2015 03:59
Change the post type labels in Easy Digital Downloads
<?php
function my_child_theme_set_download_labels( $labels ) {
$labels = array(
'name' => _x( 'Products', 'post type general name', 'your-theme-name' ), // this is the one that is "downloads" by default, change this to Templates
'singular_name' => _x( 'Product', 'post type singular name', 'your-theme-name' ),
'add_new' => __( 'Add New', 'your-theme-name' ),
'add_new_item' => __( 'Add New Product', 'your-theme-name' ),
'edit_item' => __( 'Edit Product', 'your-theme-name' ),
'new_item' => __( 'New Product', 'your-theme-name' ),
@amdrew
amdrew / gist:6373901
Last active December 21, 2015 22:18
Make a lightbox script use both the image caption and description as the title for when the image is enlarged.
<?php
/**
* Filter Easy Image Gallery HTML to add description
*
*/
function my_child_theme_easy_image_gallery_description( $html, $rel, $image_link, $image_class, $image_caption, $image, $attachment_id, $post_id ) {
// get the image's description
$image_description = get_post( $attachment_id )->post_content ? get_post( $attachment_id )->post_content : '';