Skip to content

Instantly share code, notes, and snippets.

View codescribblr's full-sized avatar

Jonathan Wadsworth codescribblr

View GitHub Profile
@codescribblr
codescribblr / functions.php
Created February 26, 2014 16:51
DEPRECATED -- This is no longer necessary. -- Theme modification for showcase-video-tuts plugin to work properly....
add_filter('acf/options_page/settings', 'showcase_options_page_settings');
function showcase_options_page_settings( $settings ) {
$settings['title'] = 'Site Options';
$settings['slug'] = 'custom-theme-options';
$settings['menu'] = 'Site Options';
$settings['pages'] = array_merge(array('Site Options'), $settings['pages']);
return $settings;
}
@codescribblr
codescribblr / video-functions.php
Created February 17, 2014 21:35
functions related to video embeds in wordpress
<?php
# This file contains functions that are related with videos
#
# Filters/resizes video embed codes.
#
function filter_video($html, $wmode = false, $width = false, $height = false) {
$final_html = $html;
if ($wmode) {
if (strpos($final_html, 'iframe') !== FALSE && strpos($final_html, 'youtube') !== FALSE) {
@codescribblr
codescribblr / Snipplr-69724.txt
Created February 13, 2014 21:42
Color Transition on mousover
-webkit-transition: background-color 0.2s;
-moz-transition: background-color 0.2s;
-o-transition: background-color 0.24s;
-ms-transition: background-color 0.2s;
transition: background-color 0.2s;
@codescribblr
codescribblr / Snipplr-64555.txt
Created February 13, 2014 21:42
Indexhibit Fullscreen Css Background
<?PHP
/*==================================================*/
/*======= Indexhibit full background image =========*/
/*======= Plugin version 1.0 =========*/
/*==================================================*/
/* @author Steffen Görg aka G470 http://gatonet.de */
/*===================== USAGE ======================*/
@codescribblr
codescribblr / Snipplr-63359.txt
Created February 13, 2014 21:42
Add attachments to Events Calendar Pro (2.1) iCal feed
add_filter('tribe_ical_feed_item','tribe_add_attachment_to_ical', 10, 2);
function tribe_add_attachment_to_ical($item, $event){
$args = array(
'post_type' => 'attachment',
'numberposts' => -1,
'post_status' => null,
'post_parent' => $event->ID
);
@codescribblr
codescribblr / Snipplr-65712.txt
Created February 13, 2014 21:42
Wordpress gravitar addons
add_filter( 'avatar_defaults', 'newgravatar' );
function newgravatar ($avatar_defaults) {
$myavatar = get_bloginfo('template_directory') . '/images/buildinternet-gravatar.jpg';
$avatar_defaults[$myavatar] = "Build Internet";
return $avatar_defaults;
}
@codescribblr
codescribblr / Snipplr-65702.txt
Created February 13, 2014 21:42
Wordpress get attachements for post or page
$args = array(
'post_type' => 'attachment',
'post_mime_type' => 'image',
'post_parent' => $post->ID
);
$images = get_posts( $args );
foreach($images as $image):
echo wp_get_attachment_image($image->ID, 'medium');
endforeach;
@codescribblr
codescribblr / image-functions.php
Last active June 13, 2016 21:21
Wordpress functions for image resizing using timthumb
// http://www.binarymoon.co.uk/2012/02/complete-timthumb-parameters-guide/
function get_thumb_src($src, $width="100", $height="100", $quality="85", $alignment="", $zoomcrop="", $filters="", $sharpen="", $canvascolor="", $transparency=""){
if($src=="") return FALSE;
$src = "src=".$src;
$width = "&w=".$width;
$height = "&h=".$height;
$quality = "&q=".$quality;
$alignment = (!empty($alignment)) ? "&a=".$alignment : "";
@codescribblr
codescribblr / Snipplr-60202.txt
Created February 13, 2014 21:42
Using Advanced Custom Fields\' Relationship Field to show attachments of a related post
foreach(get_field('relationship') as $related) :
$args = array(
'post_type' => 'attachment',
'numberposts' => -1,
'post_status' => null,
'post_parent' => $related->ID,
);
$attachments = get_posts( $args );
foreach ( $attachments as $attachment ) :
$headshot = wp_get_attachment_image_src($attachment->ID, "medium");
@codescribblr
codescribblr / Snipplr-70539.txt
Created February 13, 2014 21:42
transparent png drop shadow
.shadowed {
-webkit-filter: drop-shadow(0px 0px 5px rgba(0,0,0,0.8));
filter: url(shadow.svg#drop-shadow);
-ms-filter: "progid:DXImageTransform.Microsoft.Dropshadow(OffX=12, OffY=12,
Color='#444')";
filter: "progid:DXImageTransform.Microsoft.Dropshadow(OffX=12, OffY=12,
Color='#444')";
}