Skip to content

Instantly share code, notes, and snippets.

@tjhole
tjhole / functions.php
Created August 25, 2015 12:24
ACF vs iThemes Exchange Plugin Conflict Quick Fix
/* ========================================================================================================================
ACF vs iThemes Exchange Quick Fix
======================================================================================================================== */
add_action('admin_head', 'acf_exchange_fix');
function acf_exchange_fix() {
echo "<style>
@tjhole
tjhole / CSS: Backface Hidden
Created April 23, 2015 18:50
CSS: Backface Hidden
-webkit-backface-visibility: hidden; /* Chrome, Safari, Opera */
backface-visibility: hidden;
@tjhole
tjhole / CSS: TranslateY
Last active August 29, 2015 14:18
CSS: TranslateY
transform:translateY(-50%);
-ms-transform:translateY(-50%); /* IE 9 */
-moz-transform:translateY(-50%); /* Firefox */
-webkit-transform:translateY(-50%); /* Safari and Chrome */
-o-transform:translateY(-50%); /* Opera */
@tjhole
tjhole / WORDPRESS: Function oEmbed Container
Created December 16, 2014 12:11
WORDPRESS: Function oEmbed Container
add_filter( 'embed_oembed_html', 'tdd_oembed_filter', 10, 4 ) ;
function tdd_oembed_filter($html, $url, $attr, $post_ID) {
$return = '<div class="flex-video">'.$html.'</div>';
return $return;
}
@tjhole
tjhole / WORDPRESS: Menu
Created December 1, 2014 10:49
WORDPRESS: Menu
<?php
$defaults = array(
'theme_location' => '',
'menu' => '',
'container' => 'div',
'container_class' => '',
'container_id' => '',
'menu_class' => 'menu',
'menu_id' => '',
@tjhole
tjhole / Wordpress: Simple Gallery and Auto Feature Function
Created November 7, 2014 18:08
Wordpress: Simple Gallery and Auto Feature Function
@tjhole
tjhole / WORDPRESS: Change Media CDN
Created November 6, 2014 09:49
WORDPRESS: Change Media CDN
function my_cdn_upload_url() {
return 'http://static.domain.com/content/uploads';
}
add_filter( 'pre_option_upload_url_path', 'my_cdn_upload_url' );
@tjhole
tjhole / ACF: Random Image
Last active August 29, 2015 14:08
ACF: Random Image
<?php
$gallery = get_field('images');
$rand = array_rand($gallery, 1);
if( $gallery ): ?>
<img src="<?php echo $gallery[$rand]['sizes']['large']; ?>" alt="<?php echo $gallery[$rand]['alt']; ?>" />
<?php endif; ?>
@tjhole
tjhole / WORDPRESS: Jquery Custom
Created October 2, 2014 10:13
WORDPRESS: Jquery Custom
wp_deregister_script('jquery');
wp_register_script('jquery', "http" . ($_SERVER['SERVER_PORT'] == 443 ? "s" : "") . "://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js", false, null);
wp_enqueue_script('jquery');
@tjhole
tjhole / WORDPRESS : Remove parent from attachment URL
Created September 22, 2014 19:19
WORDPRESS : Remove parent from attachment URL
function wpa60888_attachment_link( $link, $id ){
return home_url() . '/?attachment_id=' . $id;
}
add_filter( 'attachment_link', 'wpa60888_attachment_link', 10, 2 );